Tuesday, May 25, 2010

Four Quadratic circle with fillup different color for each

#include
#include
#include
#include

int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
int stangle = 90, endangle = 179, radius = 100;
int stangle1 = 0, endangle1 = 89;
int stangle2 = 180, endangle2 = 269;
int stangle3 = 270, endangle3 = 360;

/* 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:");
getch();
exit(1); /* terminate with an error code */
}

midx = getmaxx() / 2;
midy = getmaxy() / 2;

/* set fill style and draw a pie slice */
setfillstyle(EMPTY_FILL, getmaxcolor());
pieslice(midx, midy, stangle1, endangle1, radius);
setfillstyle(SOLID_FILL, getmaxcolor());
pieslice(midx, midy, stangle, endangle, radius);
setfillstyle(BKSLASH_FILL, getmaxcolor());
pieslice(midx,midy, stangle2, endangle2, radius);
setfillstyle(LINE_FILL, getmaxcolor());
pieslice(midx, midy, stangle3, endangle3, radius);
/* clean up */
getch();
closegraph();
return 0;
}

No comments:

Post a Comment