C语言图形库函数

C语言图形库函数

ID:40533192

大小:51.50 KB

页数:14页

时间:2019-08-04

C语言图形库函数_第1页
C语言图形库函数_第2页
C语言图形库函数_第3页
C语言图形库函数_第4页
C语言图形库函数_第5页
资源描述:

《C语言图形库函数》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、1.初始化图形系统 函数名:initgraph功 能:初始化图形系统用 法:voidfarinitgraph(intfar*graphdriver,intfar*graphmode,   charfar*pathtodriver);程序例:#include#include#include#includeintmain(void){  /*requestautodetection*/  intgdriver=DETECT,gmode,errorcode;  /*initializegraphicsmode*/ 

2、 initgraph(&gdriver,&gmode,"");  /*readresultofinitialization*/  errorcode=graphresult();  if(errorcode!=grOk) /*anerroroccurred*/  {     printf("Graphicserror:%s",grapherrormsg(errorcode));     printf("Pressanykeytohalt:");     getch();     exit(1);            /*returnwitherrorcode*/  }  /*dra

3、waline*/  line(0,0,getmaxx(),getmaxy());  /*cleanup*/  getch();  closegraph();  return0;}  2. 函数名:drawpoly功 能:画多边形用 法:voidfardrawpoly(intnumpoints,intfar*polypoints);程序例:#include#include#include#includeintmain(void){  /*requestautodetection*/  intgdriver=DE

4、TECT,gmode,errorcode;  intmaxx,maxy;  /*ourpolygonarray*/  intpoly[10];  /*initializegraphicsandlocal     variables*/  initgraph(&gdriver,&gmode,"");  /*readresultofinitialization*/  errorcode=graphresult();  if(errorcode!=grOk)  /*anerroroccurred*/  {     printf("Graphicserror:%s",     graphe

5、rrormsg(errorcode));     printf("Pressanykeytohalt:");     getch();  /*terminatewithanerrorcode*/     exit(1);  }  maxx=getmaxx();  maxy=getmaxy();  poly[0]=20;       /*1stvertext*/  poly[1]=maxy/2;  poly[2]=maxx-20;/*2nd*/  poly[3]=20;  poly[4]=maxx-50;/*3rd*/  poly[5]=maxy-20;  poly[6]=maxx/2; 

6、/*4th*/  poly[7]=maxy/2;/*  drawpolydoesn'tautomaticallyclose  thepolygon,sowecloseit.*/  poly[8]=poly[0];  poly[9]=poly[1];  /*drawthepolygon*/  drawpoly(5,poly);  /*cleanup*/  getch();  closegraph();  return0;}   函数名:ellipse功 能:画一椭圆用 法:voidfarellipse(intx,inty,intstangle,intendangle,   intxrad

7、ius,intyradius);程序例:#include#include#include#includeintmain(void){  /*requestautodetection*/  intgdriver=DETECT,gmode,errorcode;  intmidx,midy;  intstangle=0,endangle=360;  intxr

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。