- 注册时间
- 2005-2-11
- 最后登录
- 1970-1-1
|

楼主 |
发表于 2007-6-19 08:21:58
|
显示全部楼层
重镑推出第一个NC3000的4灰度库函数,目前这个函数比较简陋,主要是测试一下效果,大家编译下底下那个例子,效果很不错哦。
原型:void SetGraphMode();
功能:设置系统图形模式。
原型:void SetFgColor(int color);
功能:设置背景颜色。
说明:2色模式下无效,color只能取0~3。
原型:void SetBgColor(int color);
功能:设置前景颜色。
说明:2色模式下无效,color只能取0~3。
原型:void SetScreen4();
功能:清屏。
原型:void Point4(int x,int y,int type);
功能:画点。
说明 x,y)为点的坐标,type值含义如下:
type=0:用背景色画点
1:用前景色画点
2:点的颜色取反
直接在屏幕作图
原型:void Line4(int x0,int y0,int x1,int y1,int type);
功能:画直线。
说明 x0,y0)和(x1,y1)指定直线的两个端点坐标。
type=0:用背景色画线
1:用前景色画线
2:线的所有点取反
直接在屏幕作图
原型:void Circle4(int x,int y,int r,int type);
功能:画圆。
说明 x,y)指定圆心,r指定半径。
type=0:用背景色画圆
1:用前景色画圆
2:圆的所有点取反
直接在屏幕作图
原型:void Ellispe4(int x,int y,int a,int b,int type);
功能:画椭圆。
说明:(x,y)指定圆心,a为横半轴长度,b为纵半轴长度。
type=0:用背景色画椭圆
1:用前景色画椭圆
2:椭圆的所有点取反
直接在屏幕作图
原型:void TextOut4(int x,int y,char &string[],int type);
功能:把字符串绘制到屏幕。
说明:在屏幕的(x,y)坐标处绘制字符串,string为字符串的地址
type的bit7=1:大字体,bit7=0:小字体。
直接在屏幕上绘图。
举例:
#include <Gray.y>
void main()
{
int i,j;
SetGraphMode();
SetScreen4();
SetFgColor(1);
for(i=j=0;i<80;i=i+2)
{
SetFgColor(j++%4);
Line4(1,i,159,i,1);
}
Delay(1000);
SetScreen4();
SetFgColor(1);Circle4(80,40,35,1);
SetFgColor(2);Ellispe4(80,40,75,25,1);
Delay(1000);
SetScreen4();
SetFgColor(0);SetBgColor(1);
TextOut4(2,2,"这是一个简单的4灰度链接库",1);
SetFgColor(1);SetBgColor(2);
TextOut4(2,20,"算法不是很好,速度有点慢",1);
SetFgColor(2);SetBgColor(1);
TextOut4(2,40,"效果怎么样?",128);
SetFgColor(1);SetBgColor(0);
TextOut4(2,60,"到这里就结束了",128);
getchar();
} |
|