#include <surface.h>
Public Member Functions | |
FloodFill (Surface *surface, uint32 oldColor, uint32 fillColor, bool maskMode=false) | |
void | addSeed (int x, int y) |
void | fill () |
void | fillMask () |
Surface * | getMask () |
Stack-based flood fill algorithm for arbitrary surfaces.
This can be used in two ways. One is to fill the pixels of oldColor with fillColor. Second is when the surface stays intact but another surface with mask is created, where filled colors are marked with 255.
Before running fill() or fillMask(), the initial pixels must be addSeed with the addSeed() method.
Graphics::FloodFill::FloodFill | ( | Surface * | surface, |
uint32 | oldColor, | ||
uint32 | fillColor, | ||
bool | maskMode = false |
||
) |
Construct a simple Surface object.
surface | Input surface. |
oldColor | The color on the surface to change. |
fillColor | The color to fill with. |
void Graphics::FloodFill::addSeed | ( | int | x, |
int | y | ||
) |
Add pixels to the fill queue.
x | The x coordinate of the pixel. |
y | The x coordinate of the pixel. |
void Graphics::FloodFill::fill | ( | ) |
Fill the surface as requested.
This uses pixels that were added with the addSeed() method.
void Graphics::FloodFill::fillMask | ( | ) |
Fill the mask.
The mask is a CLUT8 surface with pixels 0 and 255. 255 means that the pixel has been filled.
This uses pixels that were added with the addSeed() method.