C语言中的pieslice()函数

pieslice() 绘制并填充以(x,y)为中心且给定半径r的饼图切片。该切片从s_角移动到e_角,e_角是饼图切片的起始角和结束角。饼图切片的角度以度为单位,并按逆时针方向测量。

null

语法:

void pieslice(int x, int y, int s_angle, 
                    int e_angle, int r);

where,
(x, y) is center of the circle.
r is the radius of the circle.
s_angle and e_angle are the starting 
and ending angles respectively.

例如:

Input : x = 300, y = 300, s_angle = 0 ,
        e_angle = 120, r = 150
Output :图片[1]-C语言中的pieslice()函数-yiteyi-C++库

Input : x = 300, y = 300, s_angle = 30 ,
        e_angle = 100, r = 200
Output :图片[2]-C语言中的pieslice()函数-yiteyi-C++库

下面是PieSicle()函数的实现:

// C Implementation for drawing pieslice
#include <graphics.h>
// driver code
int main()
{
// gm is Graphics mode which
// is a computer display mode
// that generates image using pixels.
// DETECT is a macro defined in
// "graphics.h" header file
int gd = DETECT, gm;
// initgraph initializes the
// graphics system by loading a
// graphics driver from disk
initgraph(&gd, &gm, "" );
// pieslice function
pieslice(300, 300, 0, 120, 150);
getch();
// closegraph function closes the
// graphics mode and deallocates all
// memory allocated by graphics system .
closegraph();
return 0;
}


输出:

图片[3]-C语言中的pieslice()函数-yiteyi-C++库
© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享