|
bush
银牌会员
    
积分 2165
发帖 730
注册 2004-4-21
状态 离线
|
『楼 主』:
一个pcx256色程序(古董)
typedef struct {
char PcxFlag ;
char Version ;
char Encoding ;
char Bitsperpixel ;
int Xmin ;
int Ymin ;
int Xmax ;
int Ymax ;
int Hres ;
int Vres ;
char palette[48] ;
char reserved ;
char planes ;
int width ;
int palettetype ;
char filler[58] ;
}PCXHEAD;
void pcx256display(int x,int y,int status, char * name)
{
FILE *phonefp;
unsigned long phonewidth,phoneheigh;
unsigned char phonedata,phoneline[1000];
long phonelen,phonetemp,linebit;
unsigned char ColorTable[256][3] ;
int i,j , m , b[3];
unsigned char data;
int count, total , height ;
PCXHEAD pcxheader;
if((phonefp=fopen(name,"rb"))==NULL){
//printf("cannot open file %s \n",name);
exit(0);
}
fseek( phonefp ,-768L,SEEK_END);
fread( ColorTable , 1 , 768 , phonefp ) ;
fseek( phonefp ,0L,SEEK_SET);
fread( (char *)&pcxheader , sizeof(PCXHEAD), 1, phonefp) ;
height = pcxheader.Ymax - pcxheader.Ymin +1 ;
fseek( phonefp , 128L , SEEK_SET ) ;
//printf("+++++++++++++++++++++++++++++++++%d,%d\n",height,pcxheader.width);
//getch();
if(status)
{
setfillstyle(1,BLACK); //hm_disable
bar(x+pcxheader.width-1,y+6,x+pcxheader.width+4,y+height+4); //hm_disable
bar(x+4,y+height,x+pcxheader.width+4,y+height+4); //hm_disable
}
for( i = 0 ; i<height ; i++)
{
total = 0 ;
while( total < pcxheader.width )
{
count = 1 ;
data = fgetc(phonefp);
if ( 0xc0 == ( 0xc0 & data) )
{
count = 0x3f & data ;
data = fgetc( phonefp );
}
for( j = 0 ; j < count ; j++)
if(j+total!=pcxheader.width-1) putpixel(x+j+total , y+i , data);
total += count ;
}
}
fclose(phonefp);
}
|
|
2005-10-29 13:07 |
|
|
JonePeng
金牌会员
      D◎$ Fαп
积分 4562
发帖 1883
注册 2004-1-19 来自 广东广州
状态 离线
|
『第
2 楼』:
真的很古董,只能怀旧一下。可是现在还有谁用PCX图像啊?!
|

----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
|
|
2005-10-29 20:48 |
|
|
alchemist
高级用户
   
积分 652
发帖 193
注册 2005-9-25
状态 离线
|
『第
3 楼』:
当然有人用了!任天堂 FC 红白机模拟器 Nesticle 和世嘉5代 16bi t游戏机模拟器 Genecyst 都用 PCX 保存游戏截图!
[ Last edited by alchemist on 2005-11-23 at 17:51 ]
|
|
2005-11-23 17:48 |
|
|
6622186
高级用户
   
积分 894
发帖 411
注册 2007-2-17
状态 离线
|
『第
4 楼』:
怎么用啊?
|

@set c= 不知则觉多,知则觉少,越知越多,便觉越来越少. --- 知多少.
@for,/l,%%i,in,(1,1,55)do,@call,set/p=%%c:~%%i,1%%<nul&ping/n 1 127.1>nul
|
|
2007-5-17 22:05 |
|
|