getfillsettings
Gets information about current fill pattern and color.
Defined in header <graphics.h>
Syntax
#include <graphics.h>
void far getfillsettings(struct fillsettingstype far *fillinfo);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ |
Remarks
getfillsettings fills in the fillsettingstype structure pointed to by fillinfo with information about the current fill pattern and fill color. The fillsettingstype structure is defined in graphics.h as follows:
struct fillsettingstype {
| int pattern; | /* current fill pattern */ |
| int color; }; The functions bar, barSd, fillpoly, floodfill, and pieslice all fill an area with the current fill pattern in the current fill color. There are 11 predefined fill pattern styles (such as solid, Crosshatch, dotted, and so on). Symbolic names for the predefined patterns are provided by the enumerated type fil!_patterns in graphics.h (see the following table). In addition, you can define your own fill pattern. | /* current fill color */ |
If pattern equals 12 (USER_FILL), then a user-defined fill pattern is being used; otherw^ise, pattern gives the number of a predefined pattern.
The enumerated type filljpatterns, defined in graphics.h, gives names for the predefined fill patterns, plus an indicator for a user-defined pattern.
| Name | Value | Description | |
| EMPTY FILL | 0 | Fill with background color | |
| SOLID FILL | 1 | Solid fill | |
| LINE FILL | 2 | Fill with | |
| LTSLASH FILL | 3 | Fill with/// | |
| SLASH FILL | 4 | Fill with ///, thick lines | |
| BKSLASH FILL | 5 | Fill with \\\, thick lines | |
| LTBKSLASH | FILL | 6 | Fill with \\\ |
| HATCH | FILL | 7 | Light hatch fill |
| XHATCH | FILL | 8 | Heavy Crosshatch 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 but EMPTY_FILL | fill with the current fill color; EMPTY_FILL | uses the |
current background color.
Return value
None.
See also
Example
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
/* the names of the fill styles supported */
char *fname[] = { "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" };
int main(void)
{
/* request autodetection */
int gdriver = DETECT, gmode, errorcode;
struct fillsettingstype fillinfo;
int midx, midy;
char patstr[40], colstr[40];
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult ();
if (errorcode != grOk) { /* an error occurred */
printf("Graphics error: %s\n", grapherrormsg (errorcode));
printf("Press any key to halt :");
getchO ;
exit(l); /* terminate with an error code */
}
midx = getmaxx() / 2;
midy = getmaxyO / 2;
/* get info about current fill pattern and color */
getfillsettings(&fillinfo);
/* convert fill information into strings */
sprintf(patstr, "%s is the fill style.", fname[fillinfo.pattern]
sprintf(colstr, "%d is the fill color.", fillinfo.color);
/* display the information */
settextjustify(CENTER_TEXT, CENTER_TEXT) ;
outtextxy(midx, midy, patstr);
outtextxy(midx, midy+2*textheight ("W"), colstr);
/* clean up */
getchO ;
closegraphO ;
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/graphics.h/getfillsettings/
· short form /3.1/getfillsettings/