Borland C++ reference

fillpoly

raw OCR

Draws and fills a polygon.

Defined in header <graphics.h>

Syntax

#include <graphics.h>
void far fillpoly(int numpoints, int far *polypoints);

Portability

DOSUNIXWindowsANSI CC++ only
■

Remarks

fillpoly draws the outline of a polygon with numpoints points in the current line style and color (just as drawpoly does), then fills the polygon using the current fill pattern and fill color.

polypoints points to a sequence of {numpoints x 2) integers. Each pair of integers gives the x and y coordinates of a point on the polygon.

Return value

None.

See also

Example

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
/* request  autodetection */
int gdriver  = DETECT, gmode, errorcode;
int i, maxx, maxy;

/* our polygon  array */
int poly [8];

/* 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  */

maxx = cjetmaxx()
maxy = getmaxyO
poly[0] = 20;              /* first vertex */
poly[l] = maxy  / 2;
poly[2] = maxx  - 20;      /* second vertex */
poly [3]= 20;
poly [4]= maxx  - 50;      /* third vertex */
poly[5] = maxy  - 20;
poly[6] = maxx  / 2;       /* fourth, fillpoly automatically */
poly[7] = maxy  / 2;       /* closes the polygon */
/* loop through the  fill patterns */
for  (i=EMPTY_FILL; i<USER_FILL; i++)
   /* set fill pattern  */
   setfillstyled,  getmaxcolor ());

   /* draw a filled polygon  */
   fillpoly (4, poly);
   getchO  ;
}
/* clean up */
closegraphO  ;
return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.