对象其实只是对模块的另一种提法而已,它是设计得更好的模块。
终于研究出来了
最近心情不是很好 事还多 所以一直没多弄 拖多了今天
int GRPAH_MAXX;
void init64k()/*图形初始化*/
{
int gd=DETECT,gm=0;
installuserdriver("Svga64K", Return_SVGA64K);
initgraph(&gd, &gm, "");
GRPAH_MAXX=getmaxx()+1;
}
int putpoint(int x, int y, rgb16M color)/*画点(x,y)*/
{
int page;
page = (int)((y*(long)GRPAH_MAXX +x) >> 15);
_BX = 0;
_DX =page;
_AX = 0x4f05;
__int__(0x10);
setrgbpalette(1026, color.r >> 3, color.g >> 2, color.b >> 3);
putpixel(x, y, 0);
}
unsigned int far *videoptr = (int far *)MK_FP(0xa000, 0);
unsigned int get64kdot(int x,int y)/*获取(x,y)的颜色值*/
{
long addr;
int page;
page = (int)((addr = (long)y *GRPAH_MAXX +(long)x) >> 15);
_BX = 0;
_DX =page;
_AX = 0x4f05;
__int__(0x10);
return *(videoptr + (unsigned)(addr & 0xffff));
}
rgb16M get_rgb_dot(int x,int y)/*获取颜色分量*/
{
rgb16M color_rgb;
unsigned int color;
color=get64kdot(x,y);
color_rgb.r=(color/2048)<<3;
color_rgb.g=((color%2048)/32)<<2;
color_rgb.b=((color%2048)%32)<<3;
return color_rgb;
}