新客网 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)