RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
c语言擦除图形的函数 c语言删除算法流程图

c语言中 函数名: clearviewport(), 功 能: 清除图形视区 具体怎么用?

clearviewport

创新互联从2013年成立,是专业互联网技术服务公司,拥有项目做网站、成都网站制作网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元广安做网站,已为上家服务,为广安各地企业和个人服务,联系电话:13518219792

函数名: clearviewport

功 能: 清除图形视区

用 法: void far clearviewport(void);

程序例:

#include

#include

#include

#include

#define CLIP_ON 1 /* activates clipping in viewport */

int main(void)

{

/* request auto detection */

int gdriver = DETECT, gmode, errorcode;

int ht;

/* 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:");

getch();

exit(1); /* terminate with an error code */

}

setcolor(getmaxcolor());

ht = textheight("W");

/* message in default full-screen viewport */

outtextxy(0, 0, "* -- (0, 0) in default viewport");

/* create a smaller viewport */

setviewport(50, 50, getmaxx()-50, getmaxy()-50, CLIP_ON);

/* display some messages */

outtextxy(0, 0, "* -- (0, 0) in smaller viewport");

outtextxy(0, 2*ht, "Press any key to clear viewport:");

/* wait for a key */

getch();

/* clear the viewport */

clearviewport();

/* output another message */

outtextxy(0, 0, "Press any key to quit:");

/* clean up */

getch();

closegraph();

return 0;

}

c语言的图形函数库有哪些?

图形和图像函数包含在graphics.h里面

(一) 像素函数

56. putpiel() 画像素点函数

57. getpixel()返回像素色函数

(二) 直线和线型函数

58. line() 画线函数

59. lineto() 画线函数

60. linerel() 相对画线函数

61. setlinestyle() 设置线型函数

62. getlinesettings() 获取线型设置函数

63. setwritemode() 设置画线模式函数

(三)、多边形函数

64. rectangle() 画矩形函数

65. bar() 画条函数

66. bar3d() 画条块函数

67. drawpoly() 画多边形函数

(四)、 圆、弧和曲线函数

68. getaspectratio()获取纵横比函数

69. circle()画圆函数

70. arc() 画圆弧函数

71. ellipse()画椭圆弧函数

72. fillellipse() 画椭圆区函数

73. pieslice() 画扇区函数

74. sector() 画椭圆扇区函数

75. getarccoords()获取圆弧坐标函数

(五)、 填充函数

76. setfillstyle() 设置填充图样和颜色函数

77. setfillpattern() 设置用户图样函数

78. floodfill() 填充闭域函数

79. fillpoly() 填充多边形函数

80. getfillsettings() 获取填充设置函数

81. getfillpattern() 获取用户图样设置函数

(六)、图像函数

82. imagesize() 图像存储大小函数

83. getimage() 保存图像函数

84. putimage() 输出图像函数

四、图形和图像函数

对许多图形应用程序,直线和曲线是非常有用的。但对有些图形只能靠操作单个像素才能画出。当然如果没有画像素的功能,就无法操作直线和曲线的函数。而且通过大规模使用像素功能,整个图形就可以保存、写、擦除和与屏幕上的原有图形进行叠加。

(一) 像素函数

56. putpixel() 画像素点函数

功能: 函数putpixel() 在图形模式下屏幕上画一个像素点。

用法: 函数调用方式为void putpixel(int x,int y,int color);

说明: 参数x,y为像素点的坐标,color是该像素点的颜色,它可以是颜色符号名,也可以是整型色彩值。

此函数相应的头文件是graphics.h

返回值: 无

例: 在屏幕上(6,8)处画一个红色像素点:

putpixel(6,8,RED);

57. getpixel()返回像素色函数

功能: 函数getpixel()返回像素点颜色值。

用法: 该函数调用方式为int getpixel(int x,int y);

说明: 参数x,y为像素点坐标。

函数的返回值可以不反映实际彩色值,这取决于调色板的设置情况(参见setpalette()函数)。

这个函数相应的头文件为graphics.h

返回值: 返回一个像素点色彩值。

例: 把屏幕上(8,6)点的像素颜色值赋给变量color。

color=getpixel(8,6);

C语言中的 clrscr() 函数有什么作用?

clrscr在conio.h里面。

函数名: clrscr

功能: 清除文本模式窗口

用法: void clrscr(void);

程序例:

#include

int main(void)

{int i;

clrscr();

for (i = 0; i 20; i++)

cprintf("%d\r\n", i);

cprintf("\r\nPress any key to clear screen");

getch();

clrscr();

cprintf("The screen has been cleared!");

getch();

return 0;

}


分享题目:c语言擦除图形的函数 c语言删除算法流程图
转载注明:http://cqwzjz.cn/article/dohpshd.html