Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>floodfill() fill a bounded region</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 floodfill()             Fill a Bounded Region

 #include   <graphics.h>

 void far   floodfill(x,y,border);
 int        x;
 int        y;
 int        border;

    floodfill() fills figures drawn using arc(), circle(), ellipse(),
    drawpoly(), line(), lineto(), linerel() and rectangle(). The bounded
    area is filled with the current fill pattern and fill color. The
    coordinates ('x','y') represent a point within the area to be
    flooded.  If the point is within an enclosed area, the area inside
    the border will be filled.  If the point is outside an enclosed area,
    the area outside the border will be filled.

    Returns:    Nothing. If coded, graphresult() returns a value of -7
                (out of memory in flood fill) if an error occurs while
                flood filling an area.

       Note:    floodfill() is not supported by the IBM8514 driver.

   -------------------------------- Example ---------------------------------

    The following statements draw a rectangle and fill it.

           #include <graphics.h>
           #include <conio.h>

           main()
           {
               int gdriver = DETECT;
               int gmode;

               initgraph(&gdriver,&gmode,"");
               setfillstyle(SOLID_FILL,GREEN);
               rectangle(100,100,200,200);
               floodfill(150,150,WHITE);
               getch();
               closegraph();
           }


See Also: fillpoly() setfillstyle() getfillsettings()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson