User Tools

Site Tools


c:graphics.h:pieslice

Differences

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

Link to this comparison view

c:graphics.h:pieslice [2015/05/06 23:06]
c:graphics.h:pieslice [2024/02/16 01:05] (current)
Line 1: Line 1:
 +===== pieslice =====
 +
 +
 +====Syntax of pieslice ==== 
 + <code c>
 +#include <graphics.h>
 +void pieslice(int x, int y, int stangle, int endangle, int radius);
 +  </code>
 +
 +
 +==== Description of pieslice ==== 
 +<code c>
 +pieslice draws and fills a pie slice centered at (x,y) with a radius
 +given by radius. The slice travels from stangle to endangle. The slice is
 +outlined in the current drawing color and then filled using the current
 +fill pattern and fill color.
 +The angles for pieslice are given in degrees. They are measured
 +counterclockwise, with 0 degrees at 3 o'clock, 90 degrees at 12 o'clock,
 +and so on.
 +If you're using a CGA or monochrome adapter, the examples in online Help
 +that show how to use graphics functions might not produce the expected
 +results. If your system runs on a CGA or monochrome adapter, use the
 +value 1 (one) instead of the symbolic color constant, and see the second
 +example under arc whis shows how to use the pieslice function.
 +</code>
 +
 +
 +==== Example of pieslice ====
 +<code c>
 +/* pieslice 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;
 +   int stangle = 45, endangle = 135, 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;
 +
 +   /* set fill style and draw a pie slice */
 +   setfillstyle(EMPTY_FILL, getmaxcolor());
 +   pieslice(midx, midy, stangle, endangle, radius);
 +
 +   /* clean up */
 +   getch();
 +   closegraph();
 +   return 0;
 +}
 +</code>
 +
 +
 +==== See also ====
 +[[fillelipse]]
 +[[graphresult]]
 +[[sector]]
 +[[setfillstyle]]
 +
 +
 +===== output of pieslice example ===== 
 +
 +    no output of example at the moment
 +    do not hesitate and add it...  
 +
 +
  

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War

Impressum Datenschutz