DOS真彩色模式下真彩色图像显示技术毕业(6)
2015-06-03 01:35
导读:getch(); free(wordptr); free(pic); free(pic) ; free(pic); } // 24位PCX真彩色图像全息显示函数 void truecolor(void) { register int i, j; unsigned char *pic, *p0,*p1,*p2; unsigned char page,
getch();
free(wordptr); free(pic);
free(pic) ; free(pic);
}
// 24位PCX真彩色图像全息显示函数
void truecolor(void)
{ register int i, j;
unsigned char *pic, *p0,*p1,*p2;
unsigned char page, picdata;
int n,m,k,cnt,total;
unsigned long segmet;
SetVesaMode(0x112);
map();
Selectpage(0);
n=min(480,height);
m=min(640,width);
for (k=0; k<3; k++)
pic=(unsigned char *)malloc(m);
p0=pic; p1=pic; p2=pic;
fseek(fp,0x80L,SEEK-SET);
for(i=0; ipic=p0; pic=p1; pic=p2;
for (j=0;j<3;j++) {
total = 0;
while(total < m) {
cnt = 1;
picdata = fgetc(fp);
if(0xc0==(0xc0 & picdata)) {
cnt = 0x3f & picdata;
picdata = fgetc(fp);
for (k=0; k*pic++ =picdata;
}
else
*pic++ =picdata;
total+=cnt;
}
}
pic=p0; pic=p1; pic=p2;
for (j=0;j<3*(m-1);j+=3) {
segmet=addr+j;
page=segmet>>16;
if (segmet <= 65535L) {
for (k=0; k<3; k++)
pokeb(0xa000, addr+j+k, *pic++);
}
else {
Selectpage(page);
for (k=0; k<3; k++)
pokeb(0xa000, addr+j+k, *pic++);
}
}
}
getch();
for (k=0; k<3; k++) free(pic);
}
参考文献
1.张一波.Super VGA与VESA编程指南.北京:海洋出版社,1993.8
2.张益明.微机图像文件格式大全(续篇).北京:学苑出版社,1994.7