欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

C語言

當(dāng)前位置:主頁 > 軟件編程 > C語言 >

C語言fillpoly函數(shù)詳解

來源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:C語言|點(diǎn)擊: 次

C語言中,fillpoly函數(shù)的功能是畫一個(gè)多邊形,今天我們就來學(xué)習(xí)學(xué)習(xí)。

C語言fillpoly函數(shù):填充一個(gè)多邊形

函數(shù)名:fillpoly

功  能:畫并填充一個(gè)多邊形

頭文件:#include <graphics.h>

原  型:fillpoly(int numpoints, int far *polypoints);

參數(shù)說明:numpoints 為多邊形的邊數(shù);far *polypoints 為存儲(chǔ)各頂點(diǎn)坐標(biāo)的數(shù)組,每兩個(gè)一組表示一個(gè)頂點(diǎn)的 X 和 Y 坐標(biāo)。

實(shí)例代碼:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
 
int main(void)
{
 /* request auto detection */
 int gdriver = DETECT, gmode, errorcode;
 int i, maxx, maxy;
 
 /* our polygon array */
 int poly[8];
 
 /* initialize graphics, 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 */
 }
 
 maxx = getmaxx();
 maxy = getmaxy();
 
 poly[0] = 20; /* 1st vertext */
 poly[1] = maxy / 2;
 
 poly[2] = maxx - 20; /* 2nd */
 poly[3] = 20;
 
 poly[4] = maxx - 50; /* 3rd */
 poly[5] = maxy - 20;
 
 /*
 4th vertex. fillpoly automatically
 closes the polygon.
 */
 poly[6] = maxx / 2;
 poly[7] = maxy / 2;
 
 /* loop through the fill patterns */
 for (i=EMPTY_FILL; i<USER_FILL; i++)
 {
 /* set fill pattern */
 setfillstyle(i, getmaxcolor());
 
 /* draw a filled polygon */
 fillpoly(4, poly);
 
 getch();
 }
 
 /* clean up */
 closegraph();
 return 0;
}

注:fillpoly 函數(shù)是 TC 編譯環(huán)境下的函數(shù),VC 中無法使用。

以上就是關(guān)于fillpoly函數(shù)填充多邊形功能的實(shí)現(xiàn)代碼,希望對(duì)大家的學(xué)習(xí)有所幫助。

上一篇:C++實(shí)現(xiàn)動(dòng)態(tài)綁定代碼分享

欄    目:C語言

下一篇:C++實(shí)現(xiàn)對(duì)輸入數(shù)字組進(jìn)行排序

本文標(biāo)題:C語言fillpoly函數(shù)詳解

本文地址:http://mengdiqiu.com.cn/a1/Cyuyan/2668.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有