c语言做文件切片,C语言 pieslice()用法及代码示例

pieslice()绘制并填充中心为(x,y)且给定半径为r的饼图。切片从s_angle到e_angle,它们是饼图切片的开始角度和结束角度。扇形的角度以度为单位,并逆时针测量。

用法:

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:

5da80fcd398af84f530e89bc6a14a5f6.png

Input:x = 300, y = 300, s_angle = 30 ,

e_angle = 100, r = 200

Output:

4bcf9e6acf229a3ff7c9d0a3c90f4828.png

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

// C Implementation for drawing pieslice

#include

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

}

输出:

5da80fcd398af84f530e89bc6a14a5f6.png

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值