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>setfillstyle() set the fill pattern and fill color</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 setfillstyle()          Set the Fill Pattern and Fill Color

 #include   <graphics.h>

 void far   setfillstyle(pattern,color);
 int        pattern;
 int        color;

    setfillstyle() sets the current fill pattern and fill color used by
    bar(), bar3d(), fillpoly(), floodfill() and pieslice().  There are 11
    predefined fill patterns. In addition you can fill a shape in with
    the background color or a user-defined pattern. The names for the
    predefined patterns are found in 'fill_patterns' in <graphics.h>:

     Name           Value     Description
     EMPTY_FILL       0       Fill with background color
     SOLID_FILL       1       Solid fill
     LINE_FILL        2       Fill with horizontal lines
     LTSLASH_FILL     3       Fill with ///, regular lines
     SLASH_FILL       4       Fill with ///, thick lines
     BKSLASH_FILL     5       Fill with \\\, thick lines
     LTBKSLASH_FILL   6       Fill with \\\, regular lines
     HATCH_FILL       7       Fill with hatch fill
     XHATCH_FILL      8       Fill with heavy hatch fill
     INTERLEAVE_FILL  9       Interleaving line fill
     WIDE_DOT_FILL   10       Widely spaced dot fill
     CLOSE_DOT_FILL  11       Closely spaced dot fill
     USER_FILL       12       User-defined fill pattern

    All patterns except EMPTY_FILL use the current fill color.

    Returns:    Nothing. If coded, graphresult() returns -11 (graphics
                error) if invalid input was passed. The current fill
                pattern and fill color remain the same.

       Note:    To set a user-designed pattern, use setfillpattern(). Do
                not use setfillstyle() with a 'upattern' of USER_FILL.

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

    The following statements draw a pieslice and fill it with 11
    different patterns in 15 different colors.

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

           int gdriver = DETECT;
           int gmode;

           main()
           {
               struct fillsettingstype saveset;
               int pat, clr;

               initgraph(&gdriver,&gmode,"");
               for (pat = 1; pat < 12; pat++)  {
                   for (clr = 1; clr <16; clr++) {
                       setfillstyle(pat,clr);
                       pieslice(100,100,0,134,49);
                       getch();
                   }
               }
               closegraph();
           }


See Also: fillpoly() floodfill() getfillpattern() getfillsettings()

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