图形功能

萌到你眼炸
782次浏览
2021年02月01日 16:31
最佳经验
本文由作者推荐

爱国演讲稿-晰的组词

2021年2月1日发(作者:封禅泰山)
图形功能

一、基本概念


1

TC
图形功能受图形卡(显示卡)有控制


图形库
2

TC
的图形系统由两个部分组成


图形设备

3
、要作图,首先进入图形方式,初始化函数

void

initgraph(int *graph driver, int *graphmoe, char *pathttorive);
其中
grtaphdriver --------
图形卡

graphmode-------
模式

pathtodrive------
图形设备驱动程序所在路径名

4
、关于图形模式

5
、退出图形方式

closegraph( );
二、色彩控制

1
、设置前景颜色:



void setcolor(int color);
2
、设置背景颜色:



void setbkcolor(int color);
附:黑——
BLACK




红——
RED





蓝——
BLUE





绿——
GREEN



青——
CYAN





黄——
YELLOW

白——
WHITE


浅蓝——
LIGHBLUE
棕——
BROWN

浅红——
LIGHTRED
三、常用绘图函数

1
、画直线


1

void line(int x0, int y0, int x1, int y1);

2

void lineto(int x,int y);
2
、画圆弧









void arc(int x, int y, int stangle, int endangle, int radius);
3
、画圆











void circle(int x, int y, int radius);
4
、画椭圆









void elipse(int x, int y, int stangle, int endangle, itn xradius, int yradius);
5
、画长方形







void rectangle(int left, int top, int right, int bottom);
6
、线段类型的设置

void setlinestyle(int linestyle, unsigned upttern, int thick);
短横线
------DASHEN_LINE
用于自定
---USRBIT_LINE
upattern----
当用户自定义横线时起作用

thick--------
线段粗细

细线
-------NORM_WIDTH

1
个象素宽)

粗线
-------THICK_WIDTH

3
个象素宽)

四、着色函数

1
、着色模式和着色颜色的设置



void setfillstyle(int pattern, int color);
着色模式:


1
)以背景色着色
----EMPTY_FILL





2
)全部着色
----------SOLID_FILL

3
)水平着色
----------LINE_FILL







4
)左斜线
-------------LTSLASH_FILL

5
)左斜线,粗
-------SLASH_FILL






6
)右斜线,粗
-------BLSASH_FILL

7
)右斜线
-------------LTBKSLASH_FILL


8
)浅阴影线
----------HATCH_FILL

9
)重交叉阴影线

XHA
TCH_FILL






10
)交替直线
------INTERLEA
VE_FILL

11
)稀点
------------WIDEDOT_FILL






12
)密点
------------CLOSEDOT_FILL
2
、着色函数


1
)直方图







void bar(int left, int top, int right, int bottom);

2
)画圆饼图





void pieslice(int x, int y, int stangle, int endangle, int radius);
五、图形模式下正文输出

1
、正文的显示


1

void outtextxy(int x, int y, char *string);

2

void text(char *string);
2
、设置正文对齐方式


settextjustify(int horize, int vert);

1

horize


取值

LEFT_TEXT




CENTER_TEXT



RIGHT

2

vert




取值
BOTTOM_TEXT

CENTER_TEXT



TOP_TEXT
3
、求字符串的主高度


1

int textheight(char *string);

2

int textwidth(char *string);

爱国演讲稿-晰的组词


爱国演讲稿-晰的组词


爱国演讲稿-晰的组词


爱国演讲稿-晰的组词


爱国演讲稿-晰的组词


爱国演讲稿-晰的组词


爱国演讲稿-晰的组词


爱国演讲稿-晰的组词