TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: ALL
from: DAVE NAVARRO
date: 1998-03-06 16:19:00
subject: Fast PCX Decoder for 320x

From: dave@powerbasic.com (Dave Navarro)
Subject: Fast PCX Decoder for 320x200x256
 
'PCX viewer.
'Only works for 256 color .pcx files, at 320x200 resolution (for now:)
 
'Original code from Dave Navarro.
'Changes by Mark Phllips and Al Musella, DPM
 
'This is released to the public domain.  Use at your own risk!
 
'Compare the speed of this to Vpic!
 
$LIB ALL OFF
$DYNAMIC
DEFINT A - Z
 
TYPE Pcxheader
	Mfg AS BYTE
	Ver AS BYTE
	Enc AS BYTE
	Bpp AS BYTE
	Xmin AS INTEGER
	Ymin AS INTEGER
	Xmax AS INTEGER
	Ymax AS INTEGER
	Hres AS INTEGER
	Vres AS INTEGER
	Pal AS STRING * 48
	Resrv AS BYTE
	Colpl AS BYTE
	Bpl AS INTEGER
	Paltyp AS INTEGER
	Filler AS STRING * 58
END TYPE
 
DIM Header AS SHARED Pcxheader
DIM Times AS SHARED BYTE
DIM Chunksize AS SHARED WORD
DIM Maxscrnptr AS SHARED WORD
DIM Fsize AS SHARED LONG
DIM Textofst AS SHARED WORD
DIM Handle AS SHARED INTEGER
DIM Buffer AS SHARED STRING * 32256
 
Chunksize = 32256
 
Disfile$ = COMMAND$ 'file to DISplay
IF Disfile$ = "" THEN
  COLOR 14, 1
  CLS
  PRINT "                             .PCX Viewer"
  PRINT "  This viewer only works with 300x200x256 .pcxs for now!"
  FILES "*.pcx"
  INPUT "PCX file to Display: (Don't include the .pcx):", Disfile$
ELSE
  Disfile$ = REMOVE$(Disfile$, ".PCX")
END IF
 
 
F$ = DIR$(Disfile$ + ".PCX")
IF F$ = "" THEN
  PRINT "No File Found"
  END
END IF
 
T1# = TIMER
CALL pcxdisplay(F$)
T6# = TIMER
A$ = INPUT$(1)
CALL pcxResetScreen
PRINT F$; " took "; using"###.######"; (T6# - T1#);
PRINT " seconds to display!"
END
 
 
SUB PcxDisplay(F$)
'display .pcx f$ on screen - only works for mode 13h now
'Set up the buffer to hold raw data
  Textofst = VARPTR(Buffer) 'the seg = ds for fixed len string
 
'Open the file and get the dos handle and file size
  OPEN F$ FOR BINARY ACCESS READ SHARED AS #1
  Handle = FILEATTR(1, 2)  'The dos handle for this file
  Fsize& = LOF(1)
 
'Make sure we can do this file
  Get# 1, , Header
  IF Header.mfg  10 AND Header.ver  5 THEN
    PRINT "Not a 256 color PCX file!"
    END
  END IF
  Wid = Header.xmax - Header.xmin
 
Continued with next message...
 
*** QwkNews (tm) v2.1
 * [TN71] Internet Newsgroup: alt.lang.powerbasic
--- GEcho 1.20/Pro
---------------
* Origin: Toast House Remote (1:100/561)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.