Reads and writes PCX files. More...
Public Types | |
enum | { PCX_VERSION25 =0 , PCX_VERSION28 =2 , PCX_VERSION28COLOR =3 , PCX_VERSION30 =5 } |
Public Member Functions | |
FilePCX () | |
Default constructor. | |
Image * | Load (InputMemoryStream *pInput) |
Parses a PCX file. | |
int32_t | GetXPixelsPerInch (void) const |
Get the file image's pixels per meter for X. | |
void | SetXPixelsPerInch (uint16_t uXPixelsPerInch) |
Set the file image's pixels per meter for X. | |
int32_t | GetYPixelsPerInch (void) const |
Get the file image's pixels per meter for Y. | |
void | SetYPixelsPerInch (uint16_t uYPixelsPerInch) |
Set the file image's pixels per meter for Y. | |
const RGBAWord8_t * | GetPalette (void) const |
Get the file image's palette. | |
RGBAWord8_t * | GetPalette (void) |
Get the file image's palette. | |
const uint8_t * | GetEGAPalette (void) const |
Get the file image's EGA palette. | |
uint8_t * | GetEGAPalette (void) |
Get the file image's EGA palette. | |
void | SetPalette (const RGBWord8_t *pInput, uint_t uStartIndex=0, uint_t uPaletteSize=256) |
Set the file image's palette (RGB) | |
void | SetPalette (const RGBAWord8_t *pInput, uint_t uStartIndex=0, uint_t uPaletteSize=256) |
Set the file image's palette (RGBA) | |
Static Public Member Functions | |
static const char * | DecompressPCX (uint8_t *pOutput, uintptr_t uOutputLength, InputMemoryStream *pInput) |
Decompress PCX bitmap data. | |
static void | Merge3Planes (uint8_t *pOutput, const uint8_t *pInput, uintptr_t uWidth) |
Merge a red, green and blue strip. | |
Static Public Attributes | |
static const uint32_t | FILETYPE = 0x50435878 |
'PCXx' Mac File type for PCX files (Byte swapped on little endian machines) | |
static const uint32_t | AUXTYPE = 0x474B4F4E |
'GKON' Mac creator code for PCX files (Byte swapped on little endian machines) | |
static const uint16_t | DEFAULT_PIXELS_PER_INCH = 72 |
Default pixels per inch value for PCX files. | |
Private Attributes | |
uint16_t | m_uXPixelsPerInch |
X Pixels per inch (72) | |
uint16_t | m_uYPixelsPerInch |
Y Pixels per inch (72) | |
RGBAWord8_t | m_Palette [256] |
Palette found in the image. | |
uint8_t | m_EGAPalette [48] |
EGA palette. | |
Reads and writes PCX files.
This routine will take a PCX file image and convert it into an Image structure.
It will handle both compressed 8,15,24 and 32 bit TGA images.
This class will read and write out PCX files and use Burger::Image class instances as data transporters
anonymous enum |
Burger::FilePCX::FilePCX | ( | ) |
Default constructor.
Initializes all extra file data to defaults
|
static |
Decompress PCX bitmap data.
The format is simplicity itself.
If the input byte is less than 0xC0, then output the byte. Otherwise and with 0x3F and use it as a count and fill with the next byte.
Opcode 0xC0 does nothing.
Note : When asked to decode an ODD number of pixels, there is a hack to fix a bug in the data overrun buffer. Debabelizer can write out bad PCX files when the width is odd.
pOutput | Buffer to accept the decompressed data |
uOutputLength | Length of the buffer for decompressed data |
pInput | Data stream to read compressed data from |
|
inline |
Get the file image's EGA palette.
Obtain a pointer to the 48 byte EGA palette (16 colors, 3 bytes per color)
|
inline |
Get the file image's EGA palette.
Obtain a constant pointer to the 48 byte EGA palette (16 colors, 3 bytes per color)
|
inline |
Get the file image's palette.
Obtain a pointer to the 256 entry RGBA color palette found in the PCX file
|
inline |
Get the file image's palette.
Obtain a constant pointer to the 256 entry RGBA color palette found in the PCX file
|
inline |
Get the file image's pixels per meter for X.
Return the pixels per meter constant, usually it's 2835 (2834.6472f)
|
inline |
Get the file image's pixels per meter for Y.
Return the pixels per meter constant, usually it's 2835 (2834.6472f)
Burger::Image * Burger::FilePCX::Load | ( | InputMemoryStream * | pInput | ) |
Parses a PCX file.
Read in a PCX file and set the extra variables
Will parse 24 bit uncompressed and 8 bit compressed and uncompressed PCX files only. Other formats are not supported
pInput | Pointer to a memory stream that has a PCX file image |
|
static |
Merge a red, green and blue strip.
PCX files interleave an 8 bit per pixel scan line of only red pixels, followed by a line of green and then blue.
This function will merge the three into a strip of RGB triplets
pOutput | Buffer to receive the RGB triplets |
pInput | Buffer containing three strips of Red, Green and Blue pixels |
uWidth | Number of bytes each strip contains |
|
inline |
Set the file image's palette (RGBA)
Given a pointer to a palette, copy the colors into this class for writing to an 8 bit PCX file.
If the starting index is greater than 255, this function does nothing. If the color entry count exceeds 256 colors, the remaining colors are ignored to prevent buffer overruns
pInput | Pointer to the palette to copy |
uStartIndex | Color index of the 256 color internal palette to start modification |
uPaletteSize | Number of color entries in the palette (Maximum 256) |
|
inline |
Set the file image's palette (RGB)
Given a pointer to a palette, copy the colors into this class for writing to an 8 bit PCX file. Since the Alpha is missing from the input, each entry set will have the alpha set to zero.
If the starting index is greater than 255, this function does nothing. If the color entry count exceeds 256 colors, the remaining colors are ignored to prevent buffer overruns
pInput | Pointer to the palette to copy |
uStartIndex | Color index of the 256 color internal palette to start modification |
uPaletteSize | Number of color entries in the palette (Maximum 256) |
|
inline |
Set the file image's pixels per meter for X.
Set the pixels per meter constant
uXPixelsPerInch | New pixels per meter constant |
|
inline |
Set the file image's pixels per meter for Y.
Set the pixels per meter constant
uYPixelsPerInch | New pixels per meter constant |
|
static |
'GKON' Mac creator code for PCX files (Byte swapped on little endian machines)
|
static |
Default pixels per inch value for PCX files.
|
static |
'PCXx' Mac File type for PCX files (Byte swapped on little endian machines)
|
private |
EGA palette.
|
private |
Palette found in the image.
|
private |
X Pixels per inch (72)
|
private |
Y Pixels per inch (72)