graphdeferredresult的作用()有啥作用?

_graphgetmem_百度百科
_graphgetmem
本词条缺少概述、名片图,补充相关内容使词条更完整,还能快速升级,赶紧来吧!
_graphgetmem用法
void far *far _graphgetmem
_graphgetmem程序例
#include &&
#include &stdlib.h&
#include &stdio.h&
#include &conio.h&
#include &alloc.h&
int main(void)
/* request autodetection */
int gdriver = DETECT, gmode,
/* clear the text screen */
printf(&Press any key to initialize graphics mode:&);
/* initialize graphics and 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:&);
exit(1); /* terminate with an error code */
midx = getmaxx() / 2;
midy = getmaxy() / 2;
/* display a message */
settextjustify(CENTER_TEXT, CENTER_TEXT);
outtextxy(midx, midy, &Press any key to exit graphics mode:&);
/* clean up */
closegraph();
/* called by the graphics kernel to allocate memory */
void far * far _graphgetmem(unsigned size)
printf(&_graphgetmem called to allocate %d bytes.\n&, size);
printf(&hit any key:&);
printf(&\n&);
/* allocate memory from far heap */
return farmalloc(size);
/* called by the graphics kernel to free memory */
void far (void far *ptr, unsigned size)
printf(&_graphfreemem called to free %d bytes.\n&, size);
printf(&hit any key:&);
printf(&\n&);
/* free ptr from far heap */
farfree(ptr);
企业信用信息C语言函数手册----g开头:graphdefaults、grapherrormsg、graphresult、_graphfreemem
用圣才电子书APP或微信扫一扫,在手机上阅读本文,也可分享给你的朋友。
来源:网络 作者:未知
函数名: graphdefaults
功能: 将所有图形设置复位为它们的缺省值
用法: void far graphdefaults(void);
int main(void)
/* request auto detection */
int gdriver = DETECT, gmode,
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, &c:\\bor\\Borland\\bgi&);
/* 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:&);
exit(1); /* terminate with an error code */
maxx = getmaxx();
maxy = getmaxy();
/* output line with non-default settings */
setlinestyle(DOTTED_LINE, 0, 3);
line(0, 0, maxx, maxy);
outtextxy(maxx/2, maxy/3, &Before default values are restored.&);
/* restore default values for everything */
graphdefaults();
/* clear the screen */
cleardevice();
/* output line with default settings */
line(0, 0, maxx, maxy);
outtextxy(maxx/2, maxy/3, &After restoring default values.&);
/* clean up */
closegraph();
函数名: grapherrormsg
功能: 返回一个错误信息串的指针
用法: char *far grapherrormsg(int errorcode);
#define NONSENSE -50
int main(void)
/* FORCE AN ERROR TO OCCUR */
int gdriver = NONSENSE, gmode,
/* initialize graphics mode */
initgraph(&gdriver, &gmode, &&);
/* read result of initialization */
errorcode = graphresult();
/* if an error occurred, then output a */
/* descriptive error message. */
if (errorcode != grOk)
printf(&Graphics error: %s\n&, grapherrormsg(errorcode));
printf(&Press any key to halt:&);
exit(1); /* terminate with an error code */
/* draw a line */
line(0, 0, getmaxx(), getmaxy());
/* clean up */
closegraph();
函数名: graphresult
功能: 返回最后一次不成功的图形操作的错误代码
用法: int far graphresult(void);
int main(void)
/* request auto detection */
int gdriver = DETECT, gmode,
/* initialize graphics and 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:&);
exit(1); /* terminate with an error code */
/* draw a line */
line(0, 0, getmaxx(), getmaxy());
/* clean up */
closegraph();
函数名: _graphfreemem
功能: 用户可修改的图形存储区释放函数
用法: void far _graphfreemem(void far *ptr, unsigned size);
int main(void)
/* request auto detection */
int gdriver = DETECT, gmode,
/* clear the text screen */
printf(&Press any key to initialize graphics mode:&);
/* initialize graphics and 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:&);
exit(1); /* terminate with an error code */
midx = getmaxx() / 2;
midy = getmaxy() / 2;
/* display a message */
settextjustify(CENTER_TEXT, CENTER_TEXT);
outtextxy(midx, midy, &Press any key to exit graphics mode:&);
/* clean up */
closegraph();
/* called by the graphics kernel to allocate memory */
void far * far _graphgetmem(unsigned size)
printf(&_graphgetmem called to allocate %d bytes.\n&, size);
printf(&hit any key:&);
printf(&\n&);
/* allocate memory from far heap */
return farmalloc(size);
/* called by the graphics kernel to free memory */
void far _graphfreemem(void far *ptr, unsigned size)
printf(&_graphfreemem called to free %d bytes.\n&, size);
printf(&hit any key:&);
printf(&\n&);
/* free ptr from far heap */
farfree(ptr);
小编工资已与此赏挂钩!一赏一分钱!求打赏↓ ↓ ↓
如果你喜欢本文章,请赐赏:
已赐赏的人
我的电子书的海词问答和网友补充:
相关词典网站:C语言fillpoly函数详解
投稿:lijiao
字体:[ ] 类型:转载 时间:
在C语言中,fillpoly函数的功能是画一个多边形,并且把多边形填充。填充边框所定义的多边形的内部。fillpoly 函数的用法:void far fillpoly(int numpoints, int far *polypoints);。
C语言中,fillpoly函数的功能是画一个多边形,今天我们就来学习学习。
C语言fillpoly函数:填充一个多边形
函数名:fillpoly
功& 能:画并填充一个多边形
头文件:#include &graphics.h&
原& 型:fillpoly(int numpoints, int far *polypoints);
参数说明:numpoints 为多边形的边数;far *polypoints 为存储各顶点坐标的数组,每两个一组表示一个顶点的 X 和 Y 坐标。
实例代码:
#include &graphics.h&
#include &stdlib.h&
#include &stdio.h&
#include &conio.h&
int main(void)
/* request auto detection */
int gdriver = DETECT, gmode,
int i, maxx,
/* 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:");
/* 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);
/* clean up */
closegraph();
注:fillpoly 函数是 TC 编译环境下的函数,VC 中无法使用。
以上就是关于fillpoly函数填充多边形功能的实现代码,希望对大家的学习有所帮助。
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具

参考资料

 

随机推荐