Turbo C位图和BMP位图格式分极及应(3)
2015-06-19 01:16
导读:s[0]=lenth0x00ff;s[1]=(lenth0xff00)8; s[2]=high0x00ff;s[3]=(high0xff00)8; for(i=4;isize;i++)s[i]=0; fseek(fp,118,0); #for(l=high-1;1=0;1--) #for(q=0;qm;q++){ #for(k=0;k4;k++){ #ch=getc(fp); uch=conver
s[0]=lenth & 0x00ff; s[1]=(lenth& 0xff00)>>8;
s[2]=high & 0x00ff; s[3]=(high & 0xff00)>>8;
for (i=4; i<size; i++) s[i]=0;
fseek (fp, 118,0);
#for (l=high-1; 1>=0; 1--)
#for (q=0; q<m; q++) {
# for (k=0; k<4; k++) {
#ch=getc (fp);
uch=convert (ch);
ma[0]=ch&0x1; a[1]=(ch&0x2)>>1;
{a[2]=(ch&0x4)>>2;a[3]=(ch&0x8)>>3;
a[4]=(ch&0x10)>>4;a[5]=(ch&x20)>>5;
a[6]=(ch&0x40)>>6;a[7]=(ch&0x80)>>7;
h=7;
for (j=0; j<2; i++)
for (j=0; j<4; i++) {
e[j][i+2*k]=a[h];
h--;
}
}
#for (i=0; i<4; i++) {
# b[i]=(e[i][0]<<7)+(e[i][1]<<6)+(e[i][2]<<5)+
#(e[i][3]<<4)+(e[i][4]<<3)+(e[i][5]<<2)+
#(e[i][6]<<1)+(e[i][7]);
u s[4+number *1+q]=b[0]; s[4+number *1+q+p]=b[1];
m s[4+number *1+q+2*p]=b[2]; s[4+number *1+q+3*p]=b[3];
{ }
fclose (fp); initgraph (&driver, &mode, “d:\\tc”);
putimage (0, 0, s, 0); getch();
free(s): closegraph();
}
unsigned char convert (unsigned char ch)
/* bmp color convert vga color */
{