Borland C++ reference

getfillsettings

raw OCR

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

DOSUNIXWindowsANSI CC++ 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.

NameValueDescription
EMPTY FILL0Fill with background color
SOLID FILL1Solid fill
LINE FILL2Fill with
LTSLASH FILL3Fill with///
SLASH FILL4Fill with ///, thick lines
BKSLASH FILL5Fill with \\\, thick lines
LTBKSLASHFILL6Fill with \\\
HATCHFILL7Light hatch fill
XHATCHFILL8Heavy Crosshatch fill
INTERLEAVEFILL9Interleaving line fill
WIDE DOT FILL10Widely spaced dot fill
CLOSE DOT FILL11Closely spaced dot fill
USER FILL12User-defined fill pattern
All but EMPTY_FILLfill with the current fill color; EMPTY_FILLuses 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.