BBS: Inland Empire Archive Date: 11-21-92 (13:57) Number: 394 From: HARRY GISH Refer#: NONE To: ALL Recvd: NO Subj: 256 color PCX reader, 2 Conf: (2) Quik_Bas
"Now we position at the 128th byte, which is where the data begins." RECORD#2,128 "Read a byte" "Decode a group" READ#2,X$;1:X=ASC(X$):Bytes#=Bytes#+1 "Now we must see if the byte represents a single color value or if it is a" "multiplier value. A quirk of 256 color PCX's is that a single value of the" "top 64 colors must be encoded as a multiplier of 1 times the color. You can't" "say COLOR 255, you must say 1 times 255. This makes many 256 color PCX files" "actually larger than a simple value dump. In this case if the byte value is" "less than 193 then it is an actual value." LONGIFX<193 COLORX:PLOTPointer,Line Pointer=Pointer+1 ENDIF "Otherwise we interpret it as a multiplier. Multiplier value can be as large" "as 63." LONGIFX>192 X=X-192:READ#2,X$;1:Y=ASC(X$):Bytes#=Bytes#+1 COLORY:PLOTPointer,LineTOPointer+X-1,Line Pointer=Pointer+X ENDIF "Pointer notes the current position in the X line scan. When the line is done" "Pointer gets reset to zero." IFPointer<XResGOTO"Decode a group" Pointer=0 "If we're at line end of now we need to see if all lines are decoded. If so" "we end, otherwise we start processing the next line." IFLine=YResGOTO"End" Line=Line+1 GOTO"Decode a group" "End" WHILEINKEY$="":WEND MODE3:COLOR15,1,4:CLS:END --- Maximus/2 2.01wb * Origin: ACCESS BBS (1:124/2122)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET