The header file graphics.h contains setfillstyle() function which sets the current fill pattern and fill color. floodfill() function is used to fill an enclosed area. Current fill pattern and fill color is used to fill the area.
void setfillstyle(int pattern, int color) void floodfill(int x, int y, int border_color)
Input : pattern = HATCH_FILL, Color = RED circle : x = 250, y = 250, radius = 100 floodfill : x = 250, y = 250, border color =15 Output : Input : pattern = LTSLASH_FILL, Color = RED rectangle : left = 200, top = 200, right = 450, bottom = 450 floodfill : x = 201, y = 201, border_color = 15 Output :
Below is the table showing INT VALUES corresponding to Colors :
COLOR INT VALUES ------------------------------- BLACK 0 BLUE 1 GREEN 2 CYAN 3 RED 4 MAGENTA 5 BROWN 6 LIGHTGRAY 7 DARKGRAY 8 LIGHTBLUE 9 LIGHTGREEN 10 LIGHTCYAN 11 LIGHTRED 12 LIGHTMAGENTA 13 YELLOW 14 WHITE 15
Below is the table showing INT VALUES corresponding to Patterns :
PATTERN INT VALUES ------------------------------- EMPTY_FILL 0 SOLID_FILL 1 LINE_FILL 2 LTSLASH_FILL 3 SLASH_FILL 4 BKSLASH_FILL 5 LTBKSLASH_FILL 6 HATCH_FILL 7 XHATCH_FILL 8 INTERLEAVE_FILL 9 WIDE_DOT_FILL 10 CLOSE_DOT_FILL 11 USER_FILL 12
Below is the implementation for setfillstyle() and floodfill() function :
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Pointers in C and C++ | Set 1 (Introduction, Arithmetic and Array)
- Lex program to take input from file and remove multiple spaces, lines and tabs
- Similarities and Differences between Ruby and C language
- Code Optimization Technique (logical AND and logical OR)
- Getting System and Process Information Using C Programming and Shell in Linux
- INT_MAX and INT_MIN in C/C++ and Applications
- Difference and Similarities between PHP and C
- What are the differences between bitwise and logical AND operators in C/C++?
- Change/add only one character and print '*' exactly 20 times
- Comma in C and C++
- Return values of printf() and scanf() in C/C++
- What is return type of getchar(), fgetc() and getc() ?
- Difference Between malloc() and calloc() with Examples
- How does "void *" differ in C and C++?
- exit(), abort() and assert()
- What are the operators that can be and cannot be overloaded in C++?
- Write one line functions for strcat() and strcmp()
- Data type of character constants in C and C++
- Can we use function on left side of an expression in C and C++?
- delete and free() in C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.