ScummVM API documentation
Graphics::FloodFill Class Reference

#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 ()
 
SurfacegetMask ()
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FloodFill()

Graphics::FloodFill::FloodFill ( Surface surface,
uint32  oldColor,
uint32  fillColor,
bool  maskMode = false 
)

Construct a simple Surface object.

Parameters
surfaceInput surface.
oldColorThe color on the surface to change.
fillColorThe color to fill with.

Member Function Documentation

◆ addSeed()

void Graphics::FloodFill::addSeed ( int  x,
int  y 
)

Add pixels to the fill queue.

Parameters
xThe x coordinate of the pixel.
yThe x coordinate of the pixel.

◆ fill()

void Graphics::FloodFill::fill ( )

Fill the surface as requested.

This uses pixels that were added with the addSeed() method.

◆ fillMask()

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.

◆ getMask()

Surface* Graphics::FloodFill::getMask ( )
inline

Get the resulting mask.

See also
fillMask

The documentation for this class was generated from the following file: