#include <ImageGradientModification.h>
Public Member Functions | |
ImageTileBuffer (uint32_t imageWidth, uint32_t imageHeight, AZ::EntityId imageGradientEntityId) | |
bool | Empty () const |
Returns true if we don't have any pixel modifications, false if we do. | |
AZStd::pair< float, float > | GetOriginalPixelValueAndOpacity (const PixelIndex &pixelIndex) |
void | SetModifiedPixelValue (const PixelIndex &pixelIndex, float modifiedValue, float opacity) |
Set a modified gradient value for the given pixel index. | |
void | ApplyChangeBuffer (bool undo) |
For undo/redo operations, apply the buffer of changes back to the image gradient. | |
Tracks all of the image modifications for a single continuous paint stroke. Since most modifications will only affect a small portion of an image, this buffer divides the total image space into fixed-size tiles and only creates an individual tile buffer when at least one pixel in that tile's space is modified. While painting the paint stroke, this buffer caches all of the unmodified gradient values and the modifications for each modified pixel. The buffer is used to create a special "stroke layer" that accumulates opacity for each stroke, which then combines with the stroke opacity, stroke intensity, and blend mode to blend back into the base layer. After the paint stroke finishes, the stroke buffer ownership is handed over to the undo/redo system so that it can be used to undo/redo each individual paint stroke.
AZStd::pair< float, float > GradientSignal::ImageTileBuffer::GetOriginalPixelValueAndOpacity | ( | const PixelIndex & | pixelIndex | ) |
Get the original gradient value for the given pixel index. Since we "lazy-cache" our unmodified image as tiles, create it here the first time we request a pixel from a tile.