// boundary_fill.cpp : // This application demonstrates the boundary fill algorithm // #include #define SZ 10 // size of our "virtual shape" in pixels int shape[SZ][SZ]; // our shape is a SZxSZ square // These variables are declared & defined global because they are used by the recursive boundary fill algorithm. int stackheight = 0; // recursion depth; 0 initially int pixel = 0; // number of the pixel to be filled void InitShape(); // initializes the shapes boundary and interior void bf4( int x, int y, int clrFill, int clrBorder ); // boundary fill algorithm int main(int argc, char* argv[]) { InitShape(); // 4-connected boundary fill bf4(3,3,1,0xffffffff); // x-init, y-init, fillColor, borderColor return 0; } // void InitShape() // Initializes the interior and border pixel colors of a simulated shape to be filled // // Notes: The interior color is set to 0 initially. void InitShape() { // xxxxxxxxxx 9 // x x 8 // x x 7 // x x 6 // x x 5 // x x 4 // x x 3 // x x 2 // x x 1 // xxxxxxxxxx 0 // 0123456789 for( int ix=0; ix