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: Input:x = 300, y = 300, s_angle = 30 , e_angle = 100, r = 200 Output:
下麵是pieslice()函數的實現:
// 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;
}
輸出:
相關用法
- C語言 strlwr()用法及代碼示例
- C語言 toupper()用法及代碼示例
- C語言 tolower()用法及代碼示例
- C語言 putchar()用法及代碼示例
- C++ ldexp()用法及代碼示例
- C++ wcstoll()用法及代碼示例
- C++ iswpunct()用法及代碼示例
- C++ iswblank()用法及代碼示例
- C++ iswalnum()用法及代碼示例
- C++ exp2()用法及代碼示例
- C++ feupdateenv()用法及代碼示例
- C++ raise()用法及代碼示例
- C++ gmtime()用法及代碼示例
注:本文由純淨天空篩選整理自Sahil_Bansall大神的英文原創作品 pieslice() function in C。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。