- 注册时间
- 2005-6-25
- 最后登录
- 1970-1-1
|
发表于 2007-1-4 17:44:27
|
显示全部楼层
图形系统?
void Point(int x,int y,char type);
char GetPoint(int x,int y);
void Line(int x1,int y1,int x2,int y2,char type);
void Circle(int x,int y,int r,int begin,int end,char type);
void Ellipse(int x1,int y1,int x2,int y2,int begin,int end,char type);
void Block(int x1,int y1,int x2,int y2,char type);
void Rectangle(int x1,int y1,int x2,int y2,char type);
void LoadBmp(int left,int top,int width,int height,char type,char buffer[]);
void BitBlt(int left,int top,int width,int height,char type,char buffer[]);
void XDraw(int left,int top,int width,int height,char type);
void Fade(char color);
void ClearScreen();
void UpdateLCD(int left,int top,int width,int height);
void Refresh();
void TextOut(int x,int y,char text[],char type);
void FormatOut(int x,int y,char type,char format[],...);
void SetTextRange(int x1,int y1,int x2,int y2,char type);
char SetFgColor(char color);
char SetBgColor(char color);
char SetTransColor(char color);
char SetGraphMode(char color);
///////////////////////////////////////////////////////////////////////
解释一下:
画圆和画椭圆函数特别增加了画圆弧,如果觉得困难就不要改了。
type的取值如下:
0 1 2bit为DrawMode,取值如下:
#define DRAW_COPY 1//复制
#define DRAW_NOT 2 //反色
#define DRAW_OR 3 //或
#define DRAW_AND 4 //与
#define DRAW_XOR 5 //异或
#define DRAW_TRANS 6 //特别解释一下,使用这个参数时SetTransColor的颜色作为透明色
#define DRAW_FILL 0x20 //是否填充
FormatOut和printf差不多,只不过是将文字绘在缓冲区。
FormatOut和TextOut取值见上。
SetTextRange函数用来设置TextOut和FormatOut的绘图范围,比如在文本框中可以达到只绘半个字的效果
该函数的type6bit为状态位。
#define DRAW_SIMP 0
#define DRAW_MUTI 0x40
当设置成DRAW_SIMP时,如果字超过右边界(或起始坐标不在左边界而在左边界左边或超过下边界)时,字的多余部分会被截去,形成半个字的效果
当设置成DRAW_MUTI时,起始坐标不在左边界而在左边界左边以及超过下边界和DRAW_SIMP一样,但是当文学超过右边界时,文字会换行显示。
初始时显示区域为不换行,160*80大小。
7bit为IO,仅LoadBmp,BitBlt,UpdateLCD可以使用,取值如下:
#define DRAW_IN 0 //以上函数是将图片从变量区经处理复制到缓冲区
#define DRAW_OUT 0x80 //以上函数是将图片从缓冲区经处理复制到变量区
这样就将WriteBlock和GetBlock,LoadBmp和SaveBmp,UpdateLCD和CopyLCD合而为一,方便写程序。
除了UpdateLCD是将屏幕部分刷新(type第七位为1时是把屏幕部分反存到缓冲区中),Refresh刷新屏幕,其他函数无法操作屏幕显存。
XDraw也加强了,现在XDraw的type取值如下:
#define DRAW_MUP 1 //图形上移
#define DRAW_MDOWN 2 //图形下移
#define DRAW_MLEFT 3 //图形左移
#define DRAW_MRIGHT 4 //图形右移
#define DRAW_TX 5 //图形绕X轴反转
#define DRAW_TY 6 //图形绕Y轴反转
#define DRAW_LIGHT 7 //图形色彩渐淡
#define DRAW_DARK 8 //图形色彩加深
这些都是对规定的区域做的操作。
特别提一下,这些预处理(包括时间处理的结构体)最好直接由编译器默认或包含在系统函数头文件里,不需要用户自己输入。 |
|