ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Graphics::FloodFill Class Reference

Stack-based flood fill algorithm for arbitrary Surfaces. More...

#include <surface.h>

Collaboration diagram for Graphics::FloodFill:

List of all members.

Public Member Functions

 FloodFill (Surface *surface, uint32 oldColor, uint32 fillColor, bool maskMode=false)
 Construct a simple Surface object.
 ~FloodFill ()
void addSeed (int x, int y)
 Add pixels to the fill queue.
void fill ()
 Fill the surface as requested.
void fillMask ()
 Fill the mask.
SurfacegetMask ()
 Get the resulting mask.

Private Attributes

Common::List< Common::Point * > _queue
Surface_surface
Surface_mask
uint32 _oldColor
uint32 _fillColor
byte_visited
int _w
int _h
bool _maskMode

Detailed Description

Stack-based flood fill algorithm for arbitrary Surfaces.

It could be used in 2 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 addSeed() method.

Definition at line 356 of file surface.h.


Constructor & Destructor Documentation

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

Construct a simple Surface object.

Parameters:
surface Input surface
oldColor Color on the surface to change
fillColor Color to fill with

Definition at line 501 of file surface.cpp.

Graphics::FloodFill::~FloodFill (  ) 

Definition at line 519 of file surface.cpp.


Member Function Documentation

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

Add pixels to the fill queue.

Parameters:
x The x coordinate of the pixel.
y The x coordinate of the pixel.

Definition at line 533 of file surface.cpp.

void Graphics::FloodFill::fill (  ) 

Fill the surface as requested.

It uses pixels which were added with addSeed() method.

See also:
addSeed

Definition at line 582 of file surface.cpp.

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.

It uses pixels which were added with addSeed() method.

See also:
addSeed

Definition at line 595 of file surface.cpp.

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

Get the resulting mask.

See also:
fillMask

Definition at line 400 of file surface.h.


Member Data Documentation

Definition at line 406 of file surface.h.

int Graphics::FloodFill::_h [private]

Definition at line 408 of file surface.h.

Definition at line 405 of file surface.h.

Definition at line 410 of file surface.h.

Definition at line 406 of file surface.h.

Definition at line 403 of file surface.h.

Definition at line 404 of file surface.h.

Definition at line 407 of file surface.h.

int Graphics::FloodFill::_w [private]

Definition at line 408 of file surface.h.


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


Generated on Sat Mar 23 2019 05:07:23 for ResidualVM by doxygen 1.7.1
curved edge   curved edge