User Tools

Site Tools


c:graphics.h:circle

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:graphics.h:circle [2015/05/06 23:06] (current)
Line 1: Line 1:
 +===== circle =====
 +
 +
 +====Syntax of circle ==== 
 + <code c>
 +#include <graphics.h>
 +void circle(int x, int y, int radius);
 +  </code>
 +
 +
 +==== Description of circle ==== 
 +<code c>
 +circle draws a circle in the current drawing color with its center at
 +(x,y) and the radius given by radius.
 +The linestyle parameter does not affect arcs, circles, ellipses, or pie
 +slices. Only the thickness parameter is used.
 +If your circles are not perfectly round, adjust the aspect ratio.
 +</code>
 +
 +
 +==== Example of circle ====
 +<code c>
 +/* circle example */
 +
 +#include <graphics.h>
 +#include <stdlib.h>
 +#include <stdio.h>
 +#include <conio.h>
 +
 +int main(void)
 +{
 +   /* request autodetection */
 +   int gdriver = DETECT, gmode, errorcode;
 +   int midx, midy, radius = 100;
 +
 +   /* 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;
 +   setcolor(getmaxcolor());
 +
 +   /* draw the circle */
 +   circle(midx, midy, radius);
 +   /* clean up */
 +   getch();
 +   closegraph();
 +   return 0;
 +}
 +</code>
 +
 +
 +==== See also ====
 +[[arc]]
 +[[ellipse]]
 +[[fillellipse]]
 +[[getaspectratio]]
 +[[sector]]
 +[[setaspectratio]]
 +
 +
 +===== output of circle example ===== 
 +
 +    no output of example at the moment
 +    do not hesitate and add it...  
 +
 +
  
advertising
c/graphics.h/circle.txt · Last modified: 2015/05/06 23:06 (external edit)

Impressum Datenschutz