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>setfillpattern() select a user-defined fill pattern</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 setfillpattern()        Select a User-Defined Fill Pattern

 #include   <graphics.h>

 void far   setfillpattern(upattern,color);
 char far   *upattern;
 int        color;

    setfillpattern() allows the user to set a user-defined pattern
    instead of using a predefined one.  An 8x8 pattern is used, with
    'upattern' pointing to an array of 8 bytes used to create the
    pattern.  Whenever a bit in the pattern byte is set to 1, the
    corresponding pixel is drawn. The following fill pattern:

          char mypattern[8] = {
               0xCC,0x33,0xCC,0x33,0xCC,0x33,0xCC,0x33
          };
    translates to:
                    XX  XX
                      XX  XX
                    XX  XX
                      XX  XX
                    XX  XX
                      XX  XX
                    XX  XX
                      XX  XX

    'color' can be one of the  values or symbolic constants defined in
    <graphics.h>; see setpalette().

    Returns:    Nothing.

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

    The following statements fill a pieslice with a user-defined
    checkered pattern.

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

           int gdriver = DETECT;
           int gmode;

           main()
           {
               char mypattern[8] = {0xCC,0x33,0xCC,0x33,0xCC,0x33,0xCC,0x33};

               initgraph(&gdriver,&gmode,"");
               setfillpattern(mypattern,YELLOW);
               pieslice(200,200,0,134,49);
               getch();
               closegraph();
           }


See Also: getfillsettings() getfillpattern() setpalette()

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