保存桌面快捷方式 - - 设为首页 - 手机版
凹丫丫旗下网站:四字成语大全 - 故事大全 - 范文大全
您现在的位置: 范文大全 >> 理工论文 >> 计算机论文 >> 正文

Turbo C位图和BMP位图格式分极及应用


0); lenth=getw (fp);
/* graphics width */
fseek (fp, 22, 0); high=getw (fp);
#/* graphics high */
#if ((lenth%8)==0) number= (lenth+8)/8*4
#/* bytes of each line */
# else number=4*(ceil ((double)1enth/8));
up=number/4;
mif ((lenth%8)!=0) m=p;
{/* bytes of each line/4 */
else m=p-1;
size=6+number*(high+1)
/* need memory bytes of graphics */
if ((s=char *) malloc (size))==NULL)
{ printf (“malloc error !\n”); exit (0);}
s[0]=lenth & 0x00ff; s[1]=(lenth& 0xf

f00)>>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 */
{
unsigned char c[2];
int i;
#c[0]=(ch&0xf0)>>4;
#c[1]=ch&0x0f;
#for (i=0; i<2; i++) {
#if (c[i]==0x01) {c[i]=0x04; continue;}
uif (c[i]==0x03) {c[i]=0x6; continue;}
mif (c[i]==0x04) {c[i]=0x01; continue;}
{if (c[i]==0x06) {c[i]=0x03; continue;}
if (c[i]==0x07) {c[i]=0x8; continue;}
if (c[i]==0x08) {c[i]=0x07; continue;}
if (c[i]==0x09) {c[i]=0xc; continue;}
if (c[i]==0x0b) {c[i]=0xe; continue;}
if (c[i]==0x0c) {c[i]=0x9; continue;}
if (c[i]==0x0e) c[i]=0x0b;
}
ch=(c[0]<<4)+c[1];
return ch;
#}

《Turbo C位图和BMP位图格式分极及应用(第2页)》
本文链接地址:http://www.oyaya.net/fanwen/view/172534.html

★温馨提示:你可以返回到 计算机论文 也可以利用本站页顶的站内搜索功能查找你想要的文章。