显示16色bmp图,TC2.0,需要egavga.bgi#include"graphics.h"
#include"stdio.h"
FILE *bmpfile;
int mode=0,driver=DETECT;
long bmpwidth=0,bmphight=0;
char buf,lbuf,rbuf;
int x=0,y=480,i;
struct bh
{
char bt1;
char bt2;
long bs;
int br1;
int br2;
long bob;
} bmph;
struct bi
{
long bis;
long biw;
long bih;
int bp;
int bb;
long bic;
long bsi;
long bixp;
long biyp;
long bicu;
long bici;
}bmpi;
main()
{
initgraph(&mode,&driver,"");
bmpfile=fopen("new.bmp","ab+");
fread(&bmph,sizeof(struct bh),1,bmpfile);
fread(&bmpi,sizeof(struct bi),1,bmpfile);
/*printf("%ld",bmpi.bih);*/
i=118L;
fseek(bmpfile,i,0);
while(!feof(bmpfile))
{
fread(&buf,1,1,bmpfile);
lbuf=buf>>4;
putpixel(x,y,lbuf);
x++;
if(x>=640)
{
y--;
x=0;
}
rbuf=buf & 15;
putpixel(x,y,rbuf);
x++;
if(x>=640)
{
y--;
x=0;
}
delay(5);
}
getch();
}
#include"stdio.h"
FILE *bmpfile;
int mode=0,driver=DETECT;
long bmpwidth=0,bmphight=0;
char buf,lbuf,rbuf;
int x=0,y=480,i;
struct bh
{
char bt1;
char bt2;
long bs;
int br1;
int br2;
long bob;
} bmph;
struct bi
{
long bis;
long biw;
long bih;
int bp;
int bb;
long bic;
long bsi;
long bixp;
long biyp;
long bicu;
long bici;
}bmpi;
main()
{
initgraph(&mode,&driver,"");
bmpfile=fopen("new.bmp","ab+");
fread(&bmph,sizeof(struct bh),1,bmpfile);
fread(&bmpi,sizeof(struct bi),1,bmpfile);
/*printf("%ld",bmpi.bih);*/
i=118L;
fseek(bmpfile,i,0);
while(!feof(bmpfile))
{
fread(&buf,1,1,bmpfile);
lbuf=buf>>4;
putpixel(x,y,lbuf);
x++;
if(x>=640)
{
y--;
x=0;
}
rbuf=buf & 15;
putpixel(x,y,rbuf);
x++;
if(x>=640)
{
y--;
x=0;
}
delay(5);
}
getch();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货