新客网WWW.XKER.COM:致力做中国最专业的网络学院!
学院: 操作系统 - 网络应用 - 服务器 - 网络安全 - 工具软件 - 办公软件 - Web开发 - 数据库 - 网页设计 - 图形图像 - 媒体动画 - 硬件学堂 - 存储频道 - QQ专区
您的位置:首页 > 网络学院 > 操作系统 > DOS教程 > 正文:DOS下看真彩BMP位图的小程序

DOS下看真彩BMP位图的小程序

新客网 XKER.COM 2006-10-03 来源: 收藏本文

while((right_y-left_y)*(left_x-x)<(left_x-right_x)*(y-left_y))
{
x--;
Pixel24TrC(color,x,y);
}
x--;
if(!(y<right_y))
continue;
if((right_y-left_y)>(left_x-right_x))
while((right_y-left_y)*(left_x-x)>(left_x-right_x)*(y-left_y))
{
y++;
Pixel24TrC(color,x,y);
}
y++;
};

while(y<=right_y)
{
Pixel24TrC(color,x,y);
y++;
};
}

else
if(left_y>right_y)
{
while(x<right_x)
{
Pixel24TrC(color,x,y);
if((right_x-left_x)>(left_y-right_y))
while((left_y-right_y)*(x-left_x)<(right_x-left_x)*(left_y-y))
{
x++;
Pixel24TrC(color,x,y);
}
x++;
if(left_y-y>left_y-right_y)
continue;
if((left_y-right_y)>(right_x-left_x))
while((left_y-right_y)*(x-left_x)>(right_x-left_x)*(left_y-y))
{
y--;
Pixel24TrC(color,x,y);
}
y--;
};

while(left_y-y<=left_y-right_y)
{
Pixel24TrC(color,x,y);
y--;
};

}
else
{
while(x<right_x)
{
Pixel24TrC(color,x,y);
if((right_x-left_x)>(right_y-left_y))
while((right_y-left_y)*(x-left_x)<(right_x-left_x)*(y-left_y))
{
x++;
Pixel24TrC(color,x,y);
}

x++;

if(y>=right_y)
continue;
if((right_y-left_y)>(right_x-left_x))
while((right_y-left_y)*(x-left_x)>(right_x-left_x)*(y-left_y))
{
y++;
Pixel24TrC(color,x,y);
}
y++;
};

while(y<=right_y)
{
Pixel24TrC(color,x,y);
y++;
};
}

return 0;
}


[/code:1:9253783525]


a.h 头文件

[code:1:9253783525]
#define LINE 640


#define C256(R,G,B) (unsigned char)R*0x20%0x100+(unsigned char)G*0x4%0x20+B

#define Hi15(R,G,B) (unsigned)R*0x400%0x8000+(unsigned)G*0x20%0x400+(char)B%0x20

#define HiC(R,G,B) (unsigned)R*0x800%0x10000+(unsigned)G*32%0x800+(char)B%0x20
#define TrC(R,G,B) (unsigned long)R*0x10000%0x1000000+(unsigned long)G*0x100%0x10000+(unsigned)B%0x100
#define Hi-TrC(RGB) (unsigned long)RGB%0x10000/2048*65536+(unsigned long)RGB%2048/32*256+(unsigned char)RGB%32
#define Tr-HiC(RGB) (unsigned long)RGB%0x1000000/65536%32*2048+(unsigned long)RGB%65536/64*32+(unsigned char)(RGB%32)


#define C256_640_400 0x100
#define C256_640_480 0x101
#define C16_800_600 0x102
#define C256_800_600 0x103
#define C16_1024_768 0x104
#define C256_1024_768 0x105
#define Hi15_640_480 0x110
#define Hi640_480 0x111
#define Tr640_480 0x112
#define Hi15_800_600 0x113
#define Hi800_600 0x114
#define Tr800_600 0x115
#define Hi15_1024_768 0x116
#define Hi1024_768 0x117
#define Tr1024_768 0x118




extern void Demo(unsigned long,int,int);

extern void init(int);
extern void Pixel16HiC(int,int,int);
extern void Pixel24TrC(unsigned long,int,int);
extern void Pixel256C(char,int,int);
extern void line(unsigned long x1,unsigned long y1,unsigned long x2,unsigned long y2,unsigned long color);

/*seepic*/
extern unsigned far* readpic(FILE *fp);

extern void mouse(void);


struct bmp_head
{
int other1;
unsigned long length;
char other2[4];
unsigned int offset;
char other3[6];
unsigned int width;
char other4[2];
unsigned int hight;
char other5[4];
unsigned char color;
};
[/code:1:9253783525]


mybmp.c这是嵌入式汇编的画点函数
[code:1:9253783525]
void init(int mode)
{
asm mov bx,mode
asm mov ax,4f02h
asm int 10h
return;
}




void Pixel24TrC(unsigned long color,int x,int y)

标签:
收藏】 【评论】 【推荐】 【投稿】 【打印】 【关闭
发表评论
要记得去论坛讨论,点击注册新会员匿名评论
评论内容:不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
  • 阅读排行
  • 推荐阅读
  • 随机推荐