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>fillpoly() draw and fills a polygon</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 fillpoly()              Draw and Fills a Polygon

 #include   <graphics.h>

 void far   fillpoly(npoints,ppoints);
 int        npoints;
 int far    *ppoints;

    fillpoly() draws a polygon with 'npoints' points. 'ppoints' points to
    a sequence of pairs of integers. Each pair of integers represents the
    ('x','y') coordinates of 'npoint'.

    There should be twice as many 'ppoints' as 'npoint'.  You must always
    'close' the polygon you are drawing, by repeating the first
    coordinates given. (A triangle, with three points, should have four
    sets of coordinates, the fourth being the same as the first.)  The
    polygon is drawn in the current line style and color. It is filled
    with the current fill style and fill color.

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

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

    The following statements draw and fill two figures with different
    fill styles and colors.

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

           main()
           {
               int gdriver = DETECT;
               int gmode;
               int fig1[] =
                  {25,100, 50,50, 150,50, 175,100,  25,100};
               int fig2[] =
                  {250,150, 300,100, 400,100, 350,150, 250,150};

               initgraph(&gdriver,&gmode,"");
               fillpoly(sizeof(fig1)/(2*sizeof(int)),fig1);
               setfillstyle(SLASH_FILL,YELLOW);
               fillpoly(5,fig2);
               getch();
               closegraph();
           }


See Also: drawpoly() getfillsettings() getbkcolor() graphresult()

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