From: johne AT parallax DOT co DOT uk (John Eccleston) Newsgroups: comp.os.msdos.djgpp Subject: Re: Help with this PCX displaying source (in DJGPP & GRX) Date: Fri, 07 Feb 97 09:15:59 GMT Organization: Parallax Solutions Ltd Message-ID: <855306894.195021@red.parallax.co.uk> References: <5de3qh$egn AT news DOT interlog DOT com> NNTP-Posting-Host: red.parallax.co.uk Cache-Post-Path: red.parallax.co.uk!unknown AT parsnip DOT parallax DOT co DOT uk Lines: 67 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp "Gautam N. Lad" wrote: >Hi, >Can someome please help me with this PCX displaying source. It >works for one image, a friend sent, but others don't work. WHY? >It seems right to me. > >I've been looking for a PCX displaying source in DJGPP & GRX >and now that I have it, it doesn't work. > >NOTE: I won't be using 320x200 images only. I might be using a > smaller size. > Hi Gautam, Something I found with PCX files is that the rows are always padded to even byte boundaries, so for example if an image has a width of 27 and a height of 30 pixels then the compressed data is padded to lines of 28 pixels. In the header of the PCX is a field which tells you how many bytes per line are used to store the image. Use this to read the bytes and just ignore those that are over the image width here is my structure that defines the header of a PCX file. Load this first to get the information about the file. -----> Cut here <----- typedef struct PCXHeader { BYTE manufacturer PACKED; /* Manufacturers code always 0 */ BYTE version PACKED; /* Always 5 for 256 colour images */ BYTE encoding PACKED; /* Always set to 1 for RLE */ BYTE bitsPerPixel PACKED; /* Should be 8 for 256 colour files */ WORD minX PACKED; /* Minimum Y screen coord */ WORD minY PACKED; /* Minimum X screen coord */ WORD maxX PACKED; /* Maximum X screen coord */ WORD maxY PACKED; /* Maximum Y screen coord */ WORD horizRes PACKED; /* Horizontal resolution of the image */ WORD vertRes PACKED; /* Vertical resolution of the image */ BYTE palette[48] PACKED; /* EGA palette, not used for 256 colour files */ BYTE reserved PACKED; /* Reserved for future use */ BYTE colourPlanes PACKED; /* Number of colour planes */ WORD bytesPerLine PACKED; /* Number of bytes per line of the image */ WORD paletteType PACKED; /* Should be 2 for colour palette */ BYTE filler[58] PACKED; /* Reserved for future use */ } PCXHeader; -----> Cut here <----- If you would like the whole of my PCX loading code then please email me. Hope this helps John ________________________________________________________________ Parallax Solutions Ltd. Tel.: 01203 514522 Stonecourt, Fax.: 01203 514401 Siskin Drive, Web : http://www.parallax.co.uk/~johne Coventry CV3 4FJ Mail: johne AT parallax DOT co DOT uk ________________________________________________________________ Good manners cost nothing, bad manners can cost you everything ________________________________________________________________