'=========================================================================== ' Subject: VGA PCX VIEWER Date: 12-14-95 (02:55) ' Author: Steven Sensarn Code: QB, QBasic, PDS ' Origin: alt.lang.basic Packet: GRAPHICS.ABC '=========================================================================== SCREEN 13 CLS TYPE TH MAN AS STRING * 1 VER AS STRING * 1 ENC AS STRING * 1 BIT AS STRING * 1 XLS AS INTEGER YLS AS INTEGER XMS AS INTEGER YMS AS INTEGER HRE AS INTEGER VRE AS INTEGER COL AS STRING * 48 RES AS STRING * 1 PLA AS STRING * 1 BYT AS INTEGER PAL AS INTEGER FIL AS STRING * 58 END TYPE DIM H AS TH DIM DAT AS STRING * 1 FILE$ = "DEMO.PCX" ' Change File Name OPEN FILE$ FOR BINARY AS #1 GET #1, 1, H C = 1 Y = 1: X = 1 WHILE C <= 64000 GET #1, , DAT IF ASC(DAT) > 192 AND ASC(DAT) <= 255 THEN LPS = ASC(DAT) - 192 GET #1, , DAT VALUE = ASC(DAT) WHILE LPS > 0 PSET (X, Y), VALUE IF X = 320 THEN X = 1: Y = Y + 1 ELSE X = X + 1 C = C + 1 LPS = LPS - 1 WEND ELSE VALUE = ASC(DAT) PSET (X, Y), VALUE IF X = 320 THEN X = 1: Y = Y + 1 ELSE X = X + 1 C = C + 1 END IF WEND GET #1, LOF(1) - 768, DAT FOR LPS = 0 TO 255 GET #1, , DAT A = INT(ASC(DAT) / 4) GET #1, , DAT B = INT(ASC(DAT) / 4) GET #1, , DAT C = INT(ASC(DAT) / 4) SLOT = LPS GOSUB CHANGECOLOR NEXT LPS CLOSE END CHANGECOLOR: R& = A G& = B B& = C G& = G& * 256 B& = B& * 65536 RGB& = R& + G& + B& PALETTE SLOT, RGB& RETURN