劳驾,帮个忙

sunruijia 2000-08-10 07:14:00
哪位大虾能提供一个用TC2编的可以在DOS下快速显示BMP,GIF图片的代码,我想用它做动画。最好有详细说明。在此谢过。
...全文
209 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
Kevin_qing 2000-08-17
  • 打赏
  • 举报
回复
给我你的e-mail
我的程序回來被我移植到watcom c++上了,可能你需要自己進行一些修改
Kevin_qing 2000-08-16
  • 打赏
  • 举报
回复
天呀!发了這麼多???
Kevin_qing 2000-08-16
  • 打赏
  • 举报
回复
我有支持SVGA的显示函数库,你需要吗?
dos下每秒600帧以上的绘图速度(640X480X8bits),可以读取并显示bmp,pcx,flc动画。


另外可以直接写显存加快绘图速度!
如13h模式下 (320X200X8its) a000:0-a000:FA00 是显示缓冲区
更高分辨率需要進行换页处理

Kevin_qing 2000-08-16
  • 打赏
  • 举报
回复
我有支持SVGA的显示函数库,你需要吗?
dos下每秒600帧以上的绘图速度(640X480X8bits),可以读取并显示bmp,pcx,flc动画。


另外可以直接写显存加快绘图速度!
如13h模式下 (320X200X8its) a000:0-a000:FA00 是显示缓冲区
更高分辨率需要進行换页处理
Kevin_qing 2000-08-16
  • 打赏
  • 举报
回复
我有支持SVGA的显示函数库,你需要吗?
dos下每秒600帧以上的绘图速度(640X480X8bits),可以读取并显示bmp,pcx,flc动画。


另外可以直接写显存加快绘图速度!
如13h模式下 (320X200X8its) a000:0-a000:FA00 是显示缓冲区
更高分辨率需要進行换页处理
Kevin_qing 2000-08-16
  • 打赏
  • 举报
回复
我有支持SVGA的显示函数库,你需要吗?
dos下每秒600帧以上的绘图速度(640X480X8bits),可以读取并显示bmp,pcx,flc动画。


另外可以直接写显存加快绘图速度!
如13h模式下 (320X200X8its) a000:0-a000:FA00 是显示缓冲区
更高分辨率需要進行换页处理
sunruijia 2000-08-16
  • 打赏
  • 举报
回复
Kevin_qing,我要你的代码,不过千万别发很多次:-)
lty 2000-08-15
  • 打赏
  • 举报
回复
要想快,直接去读写显示寄存器。很可怕呀。
Wingsun 2000-08-15
  • 打赏
  • 举报
回复
# include "dir.h"
# include "dos.h"
# include "conio.h"
# include "stdio.h"
# include "stdlib.h"
# include "graphics.h"

struct tag_BITMAP_FILE_HENDER
{
unsigned int Bf_Type;
unsigned long Bf_Size;
unsigned int Reserved1;
unsigned int Reserved2;
unsigned long Bf_Offset;
}BitMap_File_Header;

struct tag_BITMAP_INFO_HEADER
{
unsigned long Bi_Size;
unsigned long Bi_Width;
unsigned long Bi_Height;
unsigned int Bi_Planes;
unsigned int Bi_Bit_Count;
unsigned long Bi_Compression;
unsigned long Bi_Size_Image;
unsigned long Bi_X_Pels_Per_Meter;
unsigned long Bi_Y_Pels_Per_Meter;
unsigned long Bi_Color_Used;
unsigned long Bi_Color_Important;
}BitMap_Info_Header;

struct tag_RGBQUAD
{
unsigned char RGB_Blue;
unsigned char RGB_Green;
unsigned char RGB_Red;
unsigned char RGB_Reserved;
}RGB_Quad;

void Set_Palette(FILE * File_Point);

void DisPlay_BitMap(FILE * File_Point,int col,int row);

void BitMap_Demo(char filename[]);

void InitGraph();

main(int argc,char * argv[])
{
int done;

struct ffblk fileblk;

if(argc!=2)
{
printf("error\n");
exit(0);
}

InitGraph();

done=findfirst(argv[1],&fileblk,FA_SYSTEM|FA_HIDDEN|FA_RDONLY|FA_ARCH);
while(!done)
{
BitMap_Demo(fileblk.ff_name);
done=findnext(&fileblk);
}

restorecrtmode();

}

void Set_Palette(FILE * File_Point)

/* set the palette ,used the BitMap_info
of the palette */

{

int i;

fseek(File_Point,0x36,SEEK_SET);

outportb(0x3c8,0);

for(i=0;i<15;i++)
{
fread(&RGB_Quad,sizeof(RGB_Quad),1,File_Point);

outportb(0x3c9,RGB_Quad.RGB_Red>>2);
outportb(0x3c9,RGB_Quad.RGB_Green>>2);
outportb(0x3c9,RGB_Quad.RGB_Blue>>2);

}

}

void DisPlay_BitMap(FILE * File_Point,int col,int row)
{
unsigned long height,width;
unsigned char * color;

int i,j,k;
int Repeat_Count;

fseek(File_Point,BitMap_File_Header.Bf_Offset,SEEK_SET);

height=BitMap_Info_Header.Bi_Height;
width=BitMap_Info_Header.Bi_Width;
color=(char *)malloc(sizeof(char));

for(i=0;i<height;i++)
{

for(j=0;j<width;j++)
{
* color=fgetc(File_Point);
if( ( ( ( (* color)&0xc0)>>6)==3)&(BitMap_Info_Header.Bi_Compression!=0))
{
Repeat_Count=(* color)&0x3f;
* color=fgetc(File_Point);
for(k=0;k<Repeat_Count;k++)
{
putpixel(col+(j++)+k,row+(height-i),((* color)&0x0f0)>>4);
putpixel(col+j+k,row+(height-i),(* color)&0x0f);
}
}
else
{
putpixel(col+(j++),row+(height-i),((* color)&0x0f0)>>4);
putpixel(col+j,row+(height-i),(* color)&0x0f);
}
}

}

getch();

fclose(File_Point);


}

void BitMap_Demo(char filename[])
{

FILE * File_Point;

File_Point=fopen(filename,"rb");

cleardevice();

if(File_Point==NULL)
{
printf("\n the file %s isn't exist!\n",filename);
getch();
return;
}

fseek(File_Point,0,SEEK_SET);

fread(&BitMap_File_Header,sizeof(BitMap_File_Header),1,File_Point);
fread(&BitMap_Info_Header,sizeof(BitMap_Info_Header),1,File_Point);

if(BitMap_File_Header.Bf_Type!=0x4d42)
{
printf("\n %s Not a BMP file!\n",filename);
getch();
return;
}

if(BitMap_Info_Header.Bi_Compression!=0)
{
printf("\n Cannot display A compressed BMP file:%s !\n",filename);
getch();
/* return;*/
}

if(BitMap_Info_Header.Bi_Bit_Count!=4)
{
printf("\n %s Not a index 16 color BMP file !\n",filename);
getch();
return;
}

Set_Palette(File_Point);

DisPlay_BitMap(File_Point,45,45);

}

void InitGraph()
{
int gd=VGA,gm=VGAHI;

if(registerfarbgidriver(EGAVGA_driver_far)<0)
exit(1);

if(registerfarbgifont(small_font_far)<0)
exit(1);

if(registerfarbgifont(triplex_font_far)<0)
exit(1);

if(registerfarbgifont(gothic_font_far)<0)
exit(1);

initgraph(&gd,&gm,"");

}
sunruijia 2000-08-14
  • 打赏
  • 举报
回复
麻烦WINGSUN大侠写上你的代码,起码有50分献上
Wingsun 2000-08-14
  • 打赏
  • 举报
回复
我有显示BMP图的代码,但是速度不快,可供你参考。GIF的没有,不过他的显示方法和BMP一样,你只需要知道GIF的格式就可以了。
LaoZheng 2000-08-14
  • 打赏
  • 举报
回复
?

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧