home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Intermedia 1998 January
/
inter1_98.iso
/
www
/
rozi
/
PCX.ZIP
/
PCX256.PAS
next >
Wrap
Pascal/Delphi Source File
|
1996-04-04
|
927b
|
55 lines
{$M 16384,0,200000}
program PCX256;
uses PCX256UN,crt;
var
f:file;
x,y,n:word;
H:PCXHeader;
Line:ScanLine;
RGB:ExtPalette;
ReadByte:byte;
ByteOffset:word;
RepCount,k:byte;
i:word;
procedure rys(naz:string);
begin
ReadPCXHeader(naz,H);
ReadExtendedPalette(naz,RGB);
InstallExtendedPalette(RGB);
{SetGrayDisplay;}
assign(f,naz);
reset(f,1);
seek(f,128);
x:=0;
for y:=H.YMIN to H.YMAX do
begin
ByteOffset:=0;
while ByteOffset<H.BYtesPerLine do
begin
Blockread(f,ReadByte,1);
if (ReadByte and $C0)=$C0 THEN
begin
RepCount:=ReadByte and $3f;
blockread(f,readbyte,1);
for k:=1 to repcount do
begin
Line[ByteOffset]:=ReadByte;
inc(ByteOffset);
end;
end else
begin
Line[ByteOffset]:=ReadByte;
inc(ByteOffset);
end;
end;
CopyToVRAM(@Line,GetPixel256Addr(x,y),h.BytesPerLine);
end;
close(f);
end;
begin
VGAInit(VGA_256);
repeat
rys('1.pcx');
until keypressed;
VGAInit(Vga_Text);
end.