Floodfill Routines
Courtesy of Zeljko Juric (zjuric@utic.net.ba)
[routine slightly modified to fit the needs]
void FloodFill(short x,short y,unsigned short shade,void* tmpplane,void* dest) __attribute__((__stkparm__));
void FloodFill_R(short x,short y,unsigned short shade,void* tmpplane,void* dest) __attribute__((__regparm__(5)));
void FloodFillMF(short x,short y,unsigned short shade,void* dest) __attribute__((__stkparm__));
void FloodFillMF_R(short x,short y,unsigned short shade,void* dest) __attribute__((__regparm__(4)));
FloodFill/FloodFillMF fills the interior of an area which enclosed by an arbitrary shaped figure
(a cycle, a polygon, etc).
Parameter shade is a 16-bit unsigned integer and defines a 4x4 matrix of pixels
used to fill the interior (for example: if shade is set to 0xffff the interior is
filled completely black).
Parameter tmpplane of routine FloodFill has to be a 240 * 128 pixels large "scratch" buffer which is used
internally. Routine FloodFillMF doesn't need this additionally parameter, but it utilizes
malloc and free to allocate and release the necessary buffer. If speed is crucial you should use
routine FloodFill instead of FloodFillMF. x and y specifies a point in the destination
plane (dest) from where the filling process should be started. If the pixel at (x,y) is
already set the routine returns immediately.
NOTE: Due to the fact that FloodFill utilizes heavily the common program stack for its
operation the given tmpplane buffer shouldn't be a local LCD_BUFFER variable, but
it should be allocated dynamically by using malloc() like FloodFillMF does internally.