You are here

setfillstyle function in c

setfillstyle function sets the current fill pattern and fill color.

Declaration: void setfillstyle( int pattern, int color);

Different fill styles:

  1. enum fill_styles
  2. {
  3.    EMPTY_FILL,
  4.    SOLID_FILL,
  5.    LINE_FILL,
  6.    LTSLASH_FILL,
  7.    SLASH_FILL,
  8.    BKSLASH_FILL,
  9.    LTBKSLASH_FILL,
  10.    HATCH_FILL,
  11.    XHATCH_FILL,
  12.    INTERLEAVE_FILL,
  13.    WIDE_DOT_FILL,
  14.    CLOSE_DOT_FILL,
  15.    USER_FILL
  16. };

C programming source code for setfillstyle

  1. #include<graphics.h>
  2. #include<conio.h>
  3.  
  4. main()
  5. {
  6.    int gd = DETECT, gm;
  7.  
  8.    initgraph(&gd, &gm, "C:\\TC\\BGI");
  9.  
  10.    setfillstyle(XHATCH_FILL, RED);
  11.    circle(100, 100, 50);
  12.    floodfill(100, 100, WHITE);
  13.  
  14.    getch();
  15.    closegraph();
  16.    return 0;
  17. }