{ SPX Library Version 2.0 Copyright 1993 Scott D. Ramsay } SPX_IMG is the image handling unit. It allows loading and saving of picture files. It supports loading of 320x200x256 PCX files, BMP and my own custom compressed format. PTR files are a quick and dirty RLE picture format. It does not save the palette data in the file so use the loadcolors/savecolors procedures to use it's palette. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ type VidHdrType = record position,count : word; end; Header type for .PTR format ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Error Constants: img_noerror = 0; { no error } img_notbmp = 1; { not a win3.0 BMP file } img_notpcx = 2; { not a 256 color PCX file } img_errorload = 3; { file not found or open error } img_errorread = 4; { other disk read error } img_badcolor = 5; { not 8bit BMP file } img_errorsave = 6; { error saving PTR file } img_erralloc = 7; { memory allocation error } ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ var rgb256 : RGBlist; { palette of last loaded PCX,BMP file } ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ function loadbmp(bfilename:string;x,y:integer):integer; (x,y) Area to place the top-left corner of the image Loads only a 256 color BMP file to the active page. The palette of the loaded BMP file will be copied to the variable RGB256. If the image is larger than 320x200 then it will be clipped. Returns an error constant value ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ function loadpcx(pfilename:string):integer; Loads a 320x200x256 color PCX file to the active page. The palette of the loaded pcx file will be copied to the variable RGB256. Returns an error constant value PFILENAME: DOS file name of the pcx file to load NOTE: This function is very fast. However as a cost it will only load 320x200x256 pcx files. Use loadspcx to load pcx files that are smaller than 320x200. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ function loadspcx(fname:string;x,y:integer):boolean; Loads a 256 PCX file to the active page. The palette of the loaded pcx file will be copied to the variable RGB256. Returns an error constant value FNAME: DOS file name of the pcx file to load X,Y: Row,Column position to place the top-left of the pcx file NOTE: This function is slower than the loadpcx function. It can load 256 color pcx files of any resolution. Large pcx files will be clipped. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ procedure filepcx(var pcxfile:file;size:longint); Loads a PCX file from an open file to the active page. The palette of the loaded pcx file will be copied to the variable RGB256. PCXFILE: File to read the pcx data; SIZE: Size of the PCX data in the file ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ procedure drawpcx(var p;size:word); Displays a 320x200x256 PCX file currently in memory. P: Buffer where the pcx data is located; SIZE: Size of the PCX data in memory ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ procedure drawspcx(var start;size:longint;x,y:integer); Displays a 256 color PCX file currently in memory. START: Buffer where the pcx data is located; SIZE: Size of the PCX data in memory X,Y: Row,Column position to place the top-left of the pcx file This function will load any size pcx file. Large files will be clipped. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ function LoadPTR(fn:string;merge:boolean):integer; Loads a .PTR file to the active page. FN: DOS file name of the ptr file to load; MERGE: Set to TRUE to overlay the PTR file over the active page Returns an error constant value ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ procedure DrawPtr(var p;merge:boolean;sz:longint); Displays a PTR file currently in memory. P: Buffer where the ptr data is located; MERGE: Set to TRUE to overlay the PTR file over the active page ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ function SavePTR(fn:string):integer; Save the active page as a PTR file. FN: DOS file name of the ptr file to save ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ