栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

C语言fillpoly函数详解

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

C语言fillpoly函数详解

C语言中,fillpoly函数的功能是画一个多边形,今天我们就来学习学习。

C语言fillpoly函数:填充一个多边形

函数名:fillpoly

功  能:画并填充一个多边形

头文件:#include

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

参数说明:numpoints 为多边形的边数;far *polypoints 为存储各顶点坐标的数组,每两个一组表示一个顶点的 X 和 Y 坐标。

实例代码:

#include 
#include 
#include 
#include 
 
int main(void)
{
 
 int gdriver = DETECT, gmode, errorcode;
 int i, maxx, maxy;
 
 
 int poly[8];
 
 
 initgraph(&gdriver, &gmode, "");
 
 
 errorcode = graphresult();
 if (errorcode != grOk)
 
 {
 printf("Graphics error: %sn", grapherrormsg(errorcode));
 printf("Press any key to halt:");
 getch();
 exit(1);
 
 }
 
 maxx = getmaxx();
 maxy = getmaxy();
 
 poly[0] = 20; 
 poly[1] = maxy / 2;
 
 poly[2] = maxx - 20; 
 poly[3] = 20;
 
 poly[4] = maxx - 50; 
 poly[5] = maxy - 20;
 
 
 poly[6] = maxx / 2;
 poly[7] = maxy / 2;
 
 
 for (i=EMPTY_FILL; i

注:fillpoly 函数是 TC 编译环境下的函数,VC 中无法使用。

以上就是关于fillpoly函数填充多边形功能的实现代码,希望对大家的学习有所帮助。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/64763.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号