Saturday, April 6, 2013

setfillstyle function in c

setfillstyle function sets the current fill pattern and fill color.
Declaration :- void setfillstyle( int pattern, int color);
Different fill styles:
enum fill_styles 
{ 
   EMPTY_FILL, 
   SOLID_FILL, 
   LINE_FILL, 
   LTSLASH_FILL, 
   SLASH_FILL,
   BKSLASH_FILL, 
   LTBKSLASH_FILL, 
   HATCH_FILL, 
   XHATCH_FILL, 
   INTERLEAVE_FILL,
   WIDE_DOT_FILL, 
   CLOSE_DOT_FILL, 
   USER_FILL 
};

C programming source code for setfillstyle

#include<graphics.h>
#include<conio.h>
 
main()
{
   int gd = DETECT, gm;
 
   initgraph(&gd, &gm, "C:\\TC\\BGI");
 
   setfillstyle(XHATCH_FILL, RED);
   circle(100, 100, 50);
   floodfill(100, 100, WHITE);
 
   getch();
   closegraph();
   return 0;
}
Output of program:
setfillstyle