Refactoring CloudsEffect to compute each pixel individually#1695
Conversation
| private static ColorBgra GetFinalPixelColor (in CloudsSettings settings, ColorBgra original, PointI coordinates) | ||
| { | ||
| int dx = 2 * coordinates.X - settings.Roi.Width; | ||
| int dy = 2 * coordinates.Y - settings.Roi.Height; |
There was a problem hiding this comment.
Implementation note:
This one uses settings.Roi as the offset, the color of a pixel depends on its position with respect to the render bounds.
If we want it to depend on the absolute coordinates, that is, with respect to the canvas itself, independent of the render bounds, we need to replace this with settings.Size, and update the tests
CloudsEffectCloudsEffect to compute each pixel individually
|
In the last commit I removed the blending operations for the reasons described in previous messages, and given the insights obtained working on #1700, #1696, and #1553. I think we might (but don't know if we necessarily should) be able to re-implement them once we re-write the existing blend ops so that they work with premultiplied alpha. |
|
I'm not sure if I'm clear on what the |
|
@cameronwhite I'm not necessarily saying it's a better workflow (although it could be, because the functionality for choosing a blend mode is already implemented for the layer mechanism in Pinta so we would be avoiding repeating functionality). This However, the If we wait for the
It is possible that there might be one or two that are the same as the ones Cairo offers, just with a different name, and I would have to check that; but I think it is very likely that they are just missing. |
|
Thinking about this more I'm okay with removing it. Creating a new layer and configuring the blend mode is reasonable, especially since you might also be adjusting the opacity at the same time too, and none of the other "generator" effects like the fractals have the same option |
The aim of this is making the
Rendermethod concise and get the color of each pixel individually, like in many other effects.However, there is a caveat. The current implementation (before this pull request) uses the blend-ops of Cairo surfaces, which turn out to be different from Pinta's in some cases.
One possible solution would be implementing the remaining blend-ops. Another possible solution would be removing them from the effect itself and letting the user apply them by using layers and changing the blend mode of the layer.