paintlib - C++ - Reference

This reference describes the interfaces provided by the classes in paintlib. It is sorted by class name. You can jump to a particular entry by using the links below.

Library version: 2.4

[ PLAnyBmp | PLAnyPicDecoder | PLBmp | PLBmpDecoder | PLBmpEncoder | PLDDrawBmp | PLDIBSection | PLDataSink | PLDataSource | PLFileSink | PLFileSource | PLFilter | PLFilterContrast | PLFilterCrop | PLFilterFill | PLFilterFlip | PLFilterGetAlpha | PLFilterGrayscale | PLFilterIntensity | PLFilterLightness | PLFilterMirror | PLFilterQuantize | PLFilterResize | PLFilterResizeBilinear | PLFilterResizeBox | PLFilterResizeGaussian | PLFilterResizeHamming | PLFilterThreshold | PLFilterVideoInvert | PLIProgressNotification | PLJPEGDecoder | PLJPEGEncoder | PLMemSink | PLMemSource | PLPCXDecoder | PLPGMDecoder | PLPNGDecoder | PLPNGEncoder | PLPPMDecoder | PLPSDDecoder | PLPicDecoder | PLPicEncoder | PLPictDecoder | PLPixel24 | PLPixel32 | PLPixel8 | PLPoint | PLRect | PLResourceSource | PLStreamSink | PLTGADecoder | PLTIFFDecoder | PLTIFFDecoderEx | PLTIFFEncoder | PLTIFFEncoderEx | PLTextException | PLWEMFDecoder | PLWinBmp | Globals ]

PLAnyBmp

    #include "planybmp.h"

Derived from: public PLBmp

Manipulates uncompressed device- and platform-independent bitmaps. Supported data formats are 8 and 32 bpp. The data is stored sequentially without padding in the bitmap. The class implements exactly the interface defined by PLBmp without additions.

Public Members

`PLAnyBmp ();`

Creates an empty bitmap.
`virtual ~PLAnyBmp ();`

Destroys the bitmap.
`PLAnyBmp ( const PLBmp &Orig );`

Copy constructor
`PLAnyBmp ( const PLAnyBmp &Orig );`

Copy constructor
`PLAnyBmp &operator= ( const PLBmp &Orig );`

Assignment operator.
`PLAnyBmp &operator= ( const PLAnyBmp &Orig );`

Assignment operator.
`long GetMemUsed ();`

Returns the amount of memory used by the object.
`long GetBytesPerLine ();`

Returns number of bytes used per line.
`static long GetMemNeeded ( PLLONG width, PLLONG height, PLWORD BitsPerPixel );`

Returns memory needed by a bitmap with the specified attributes.
`static long GetBitsMemNeeded ( PLLONG width, PLLONG height, PLWORD BitsPerPixel );`

Returns memory needed by bitmap bits.

PLAnyPicDecoder

    #include "planydec.h"

Derived from: public PLPicDecoder

Class which decodes pictures with any known format. It auto-detects the format to use and delegates the work to one of the other decoder classes.

The interface to PLAnyPicDecoder is the same as PLPicDecoder.

Public Members

`PLAnyPicDecoder ();`

Creates a decoder.
`~PLAnyPicDecoder ();`

Destroys the decoder.
`virtual void MakeBmp ( PLDataSource * pDataSrc, PLBmp * pBmp, int BPPWanted = 0 );`

Decodes a picture in a block of memory.
`int GetFileFormat ();`

Called after decoding. Returns the actual file type loaded.

PLBmp

    #include "plbitmap.h"

Derived from: public PLObject

Device- and OS-independent bitmap class. Manipulates uncompressed bitmaps of all color depths.

This class is an abstract base class. It exists to define a format-independent interface for bitmap manipulation and to provide common routines. Derived classes must support at least the color depths 1, 8 and 32 bpp. PLBmp defines a public interface for general use and a protected interface for use by derived classes.

For 32 bpp, alpha channel information is stored in one byte (PL_RGBA_ALPHA) of each 4-byte pixel. To allow for optimizations when no alpha channel is present, a flag is set whenever the alpha information is valid. The complete alpha channel of a bitmap can be replaced by a different one by calling SetAlphaChannel(). A 0 in an alpha channel entry is completely transparent; a 255 is completely opaque.

Public Members

`PLBmp ();`

Empty constructor. Constructors in derived classes create a small empty bitmap to ensure that the object is always in a sane state.
`virtual ~PLBmp ();`

Empty destructor.
`PLBmp &operator= ( PLBmp const &Orig );`

Assignment operator. Note that assignment between different derived classes is possible and results in a format conversion.
`bool const operator == ( PLBmp const &Other );`

Test for equality. This function actually tests every pixel, so it's not fast. It's meant mainly for use in asserts and such.
`virtual void Create ( PLLONG Width, PLLONG Height, PLWORD BitsPerPixel, bool bAlphaChannel, const PLPoint& Resolution = PLPoint (0,0) );`

Creates a new empty bitmap. Memory for the bits is allocated but not initialized. Previous contents of the bitmap object are discarded. If bAlphaChannel is true, the bitmap is assumed to contain a valid alpha channel.
`void CreateCopy ( const PLBmp & rSrPLBmp, int BPPWanted = 0 );`

Creates a copy of rSrPLBmp, converting color depth if nessesary. Supports 1, 8 and 32 BPP. Alpha channel information is preserved.
`void CreateFilteredCopy (PLBmp & rSrPLBmp, const PLFilter & rFilter);`

Creates a copy of rSrPLBmp, applying rFilter on the way. Depending on the filter called, this is often much faster than CreateCopy() followed by ApplyFilter().
`void SetQuantizationMode ( int DitherType, int DitherPaletteType );`

Sets quality of conversion to 8 bpp. Valid parameters are defined in FilterQuantize.h.
`void SetGrayPalette ();`

Fills the color table with a grayscale palette. This function is only useable for bitmaps containing a color table. Index 0 contains black (0) and the last index contains white (255). The alpha channel is set to opaque (255) for every palette entry.
`void SetPalette ( PLPixel32 * pPal );`

Sets the color table to pPal. The contents or pPal are copied.
`void SetPaletteEntry ( PLBYTE Entry, PLBYTE r, PLBYTE g, PLBYTE b, PLBYTE a );`

Sets one entry in the color table. The function may only be called if there is a color table stored with the bitmap. The color table entry is set to the red, green, blue, and alpha values specified.
`void SetPaletteEntry ( PLBYTE Entry, PLPixel32 Value );`

Sets one entry in the color table. The function may only be called if there is a color table stored with the bitmap. The color table entry is set to the red, green, blue, and alpha values specified.
`void SetAlphaChannel ( PLBmp * pAlphaBmp );`

Replaces the alpha channel of the bitmap with a new one. This only works for bitmaps with 32 bpp. pAlphaBmp must point to an 8 bpp bitmap with the same dimensions as the object. The alpha channel information is physically copied into the bitmap.
`void ApplyFilter ( const PLFilter& Filter );`

Applies a filter to the bitmap.
`void SetPixel ( int x, int y, PLPixel32 pixel );`

Slow but simple function to set a single pixel. 32 bpp only.
`PLPixel32 GetPixel ( int x, int y ) const;`

Slow but simple function to get a single pixel. 32 bpp only.
`PLBYTE FindNearestColor ( PLPixel32 cr );`

Find the nearest color to cr in the palette used by this bitmap Only works for 8 bpp bitmaps.
`int GetWidth () const;`
`int GetHeight () const;`
`virtual long GetMemUsed () = 0;`
`int GetNumColors ();`
`int GetBitsPerPixel () const;`
`bool HasAlpha () const;`
`void SetHasAlpha (bool b );`
`virtual long GetBytesPerLine () = 0;`

Returns number of bytes used per line.
`PLPixel32 * GetPalette () const;`

Returns the address of the color table of the bitmap or NULL if no color table exists. The color table is stored as an array of consecutive PLPixel32 objects.
`PLBYTE ** GetLineArray () const;`

Returns pointer to an array containing the starting addresses of the bitmap lines. This array should be used whenever the bitmap bits need to be manipulated directly.
`PLPixel32 ** GetLineArray32 () const;`

Returns pointer to an array containing the starting addresses of the bitmap lines. This array should be used whenever the bitmap bits need to be manipulated directly.
`PLPixel24 ** GetLineArray24 () const;`

Returns pointer to an array containing the starting addresses of the bitmap lines. This array should be used whenever the bitmap bits need to be manipulated directly.
`virtual void Lock ( bool bReadable, bool bWriteable );`

Locks bitmap. GetLineArray() and other direct-access methods should only be called if the bitmap is locked. Lock and Unlock keep a lock count. In most cases (currently: all but PLDDrawBmp), the lock count will always be >= 1, so access is always possible.
`virtual void Unlock ();`

Unlocks the Bitmap surface.
`const PLPoint& GetResolution () const;`

Gets the bitmap resolution in pixels per inch. Returns 0 if the resolution is unknown.
`void SetResolution (const PLPoint& Resolution);`

Sets the bitmap resolution in pixels per inch.

Protected Members

`virtual void internalCreate ( PLLONG Width, PLLONG Height, PLWORD BitsPerPixel, bool bAlphaChannel ) = 0;`

Create a new bitmap with uninitialized bits. (Assume no memory is allocated yet.)
`virtual void freeMembers () = 0;`

Delete memory allocated by member variables.
`virtual void initLineArray () = 0;`

Initialize internal table of line addresses.
`void internalCopy ( const PLBmp & rSrPLBmp );`

Creates a new PLBmp as copy of rSrPLBmp. Assumes there is no memory allocated yet.
`void initLocals ( PLLONG Width, PLLONG Height, PLWORD BitsPerPixel, bool bAlphaChannel );`

Can be called from internalCreate() to initialize object state.

PLBmpDecoder

    #include "plbmpdec.h"

Derived from: public PLPicDecoder

Windows bitmap file decoder. Decodes bitmap files (compressed and uncompressed) of all bit depths. Returns an 8 or 32 bpp bitmap.

Public Members

`PLBmpDecoder ();` Creates a decoder `virtual ~PLBmpDecoder ();` Destroys a decoder

Protected Members

`virtual void DoDecode ( PLBmp * pBmp, PLDataSource * pDataSrc );` Does the actual decoding of bitmap data.

PLBmpEncoder

    #include "plbmpenc.h"

Derived from: public PLPicEncoder

Public Members

`PLBmpEncoder ();` Creates an encoder `~PLBmpEncoder ();` Destroys a encoder

PLDDrawBmp

    #include "plddrawbmp.h"

Derived from: public PLBmp

Public Members

`PLDDrawBmp ( IDirectDraw * pDDraw );`

Creates an empty bitmap.
`virtual ~PLDDrawBmp ();`

Destroys the bitmap.
`virtual long GetMemUsed ();`

Returns the amount of memory used by the object.
`long GetBytesPerLine ();`

Returns number of bytes used per line.
`SIZE GetSize ();`

Returns the size of the bitmap in pixels
`virtual void Lock ( bool bReadable, bool bWriteable );`

Draws the bitmap. Locks the DirectDraw surface and fills the line array. GetLineArray() returns NULL if the surface isn't locked.
`virtual void Unlock ();`

Unlocks the DirectDraw surface.
`IDirectDrawSurface * GetSurface ();`

Gets a pointer to the directdraw surface used.

Protected Members

`virtual void internalCreate ( LONG Width, LONG Height, WORD BitsPerPixel, bool bAlphaChannel );`

Create a new empty DIB. Bits are uninitialized. Assumes that no memory is allocated before the call.
`virtual void freeMembers ();`

Deletes memory allocated by member variables.
`virtual void initLineArray ();`

Initializes internal table of line addresses.

PLDIBSection

    #include "pldibsect.h"

Derived from: public PLWinBmp

This is a windows DIBSection wrapped in a PLBmp-derived class. It can be used just like a PLWinBmp can be used. In addition, PLDIBSection can give access to the bitmap as a GDI bitmap handle. This bitmap handle can be selected into a device context. All normal GDI drawing functions can be used to write on the bitmap in this way.

Internally, PLDIBSections are stored with header and bits in two separate buffers.

Public Members

`PLDIBSection ();`

Creates an empty bitmap.
`virtual ~PLDIBSection ();`

Destroys the bitmap.
`PLDIBSection ( const PLBmp &Orig );`

Copy constructor
`PLDIBSection ( const PLDIBSection &Orig );`

Copy constructor
`PLDIBSection &operator= ( PLBmp const &Orig );`

Assignment operator.
`PLDIBSection &operator= ( PLDIBSection const &Orig );`

Assignment operator.
`virtual void Detach ();`

Calling this function causes the windows DIBSection to be detached from the PLDIBSection object. The bitmap data are not deleted in this function. This means that the bitmap handle and the bitmap memory (bits and BMI) must be deleted by some other object. The PLDIBSection object is in the same state as after a constructor call after this function is called.
`virtual void Draw ( HDC hDC, int x, int y, DWORD rop = SRCCOPY );`

Draws the bitmap on the given device context using BitBlt.
`virtual BOOL DrawExtract ( HDC hDC, POINT pntDest, RECT rcSrc );`

Draws a portion of the bitmap on the given device context
`HBITMAP GetHandle ();`

Returns a GDI handle to the bitmap. This handle can be selected into a DC and used in normal GDI operations. Under Windows NT, GDI operations can be queued. This means that a program running under NT must call GdiFlush() before the DIBSection can be used again after GetHandle() has been called. See the documentation for GdiFlush() for details.

Protected Members

`virtual void internalCreate ( LONG Width, LONG Height, WORD BitsPerPixel, bool bAlphaChannel );`

Create a new empty DIB. Bits are uninitialized. Assumes that no memory is allocated before the call.
`virtual void freeMembers ();`

Deletes memory allocated by member variables.
`virtual HANDLE createCopyHandle ();`

Creates a copy of the current bitmap in a global memory block and returns a handle to this block.
`virtual void initPointers ();`

Set color table pointer & pointer to bits based on m_pBMI.

PLDataSink

    #include "pldatasink.h"

Derived from: public PLObject

This is a base class for a destination of picture data. It defines methods to open, write to, close data sinks.

Restriction: actually writes to a memory buffer that needs to be foreseen large enough by user (descendant class)

Public Members

`void Open ( const char* pszName, PLBYTE* pData, size_t MaxDataSize );`
`virtual void Close ();`
`char* GetName ();`
`PLBYTE* GetBufferPtr ();`
`size_t GetDataSize ();`
`size_t GetMaxDataSize ();`
`size_t WriteNBytes ( size_t n, PLBYTE* pData );`
`void Skip ( size_t n );`
`void CheckEOF ();`

Test to see if we didn't go past the "end of the file"

Protected Members

`PLDataSink ();` `virtual ~PLDataSink ();`

PLDataSource

    #include "pldatasrc.h"

Derived from: public PLObject

This is a base class for a source of picture data. It defines methods to open, close, and read from data sources. Does byte-order-conversions in the ReadByte, ReadWord, and ReadLong routines.

Public Members

`PLDataSource ( PLIProgressNotification * pNotification = NULL );`
`virtual ~PLDataSource ();`
`virtual void Open ( const char * pszName, int FileSize );`
`virtual void Close ();`
`char * GetName ();`
`virtual PLBYTE * GetBufferPtr ( int MinBytesInBuffer ) = 0;`

Read but don't advance file pointer.
`virtual PLBYTE * ReadNBytes ( int n );`

This needs to be overridden in derived classes.
`int GetFileSize ();`
`virtual PLBYTE * ReadEverything () = 0;`

This is a legacy routine that interferes with progress notifications. Don't call it!
`PLBYTE * Read1Byte ();`
`PLBYTE * Read2Bytes ();`
`PLBYTE * Read4Bytes ();`
`void OProgressNotification ( double part );`

handles progress notification from other libs
`void AlignToWord ();`
`void Skip ( int n );`
`void CheckEOF ();`

Test to see if we didn't go past the end of the file

PLFileSink

    #include "plfilesink.h"

Derived from: public PLDataSink

This is a class which takes a file as a destination of picture data.

Restriction: needs to allocate a buffer large enough to hold a complete image file. But we don't know its size before it's actually encoded, so we have to be generous or "accidents will happen" A better implementation would rely on memory-mapped files or implement dynamic buffering.

Public Members

`PLFileSink ();` `virtual ~PLFileSink ();` `virtual int Open ( const char * pszFName, int MaxFileSize );` `virtual void Close ();`

PLFileSource

    #include "plfilesrc.h"

Derived from: public PLDataSource

This is a class which takes a file as a source of picture data.

Public Members

`PLFileSource ( PLIProgressNotification * pNotification = NULL );`
`virtual ~PLFileSource ();`
`virtual int Open ( const char * pszFName );`
`virtual void Close ();`
`virtual PLBYTE * GetBufferPtr ( int MinBytesInBuffer );`

Read but don't advance file pointer.

PLFilter

    #include "plfilter.h"

Derived from: public PLObject

Base class for filters that operate on bitmaps. Derived classes need to override either the ApplyInPlace or the Apply function.

Public Members

`PLFilter();`
`virtual ~PLFilter() = 0;`
`virtual void ApplyInPlace(PLBmp * pBmp) const;`

In-Place Apply. Applies the filter to pBmp. The base-class version copies the bitmap after calling Apply (pBmp, pTempBmp).
`virtual void Apply(PLBmp * pBmpSource, PLBmp * pBmpDest) const;`

Applies the Filter to pBmpSource and stores the result in pBmpDest. The base-class version copies the bitmap before calling ApplyInPlace (pBmpDest).

PLFilterContrast

    #include "plfiltercontrast.h"

Derived from: public PLFilter

Enhances or reduces the image contrast using a linear mapping between input and output. The zero point (i. e., the intensity that is neither enhanced nor reduced) has to be provided. (A Contrast filter is defined in the following way: It lowers all intensity values below a given threshold, and it raises them beyond. Most applications position the threshold at 50 %. This does not always yield the best results, especially if you have an unbalanced dark/light ratio of pixels. The best you can do here is play around with the threshold.) Works for 24 and 32 bpp bitmaps.

Public Members

`PLFilterContrast(double contrast, PLBYTE offset);`

contrast is the slope of the function. offset is the intensity at which the color stays the same. Above this value, intensities are increased. Below it, they are reduced. With offset 128 and contrast 1, the image stays unchanged.

PLFilterCrop

    #include "plfiltercrop.h"

Derived from: public PLFilter

Filter that cuts part of the image off. XMin and YMin are included in the rectangle, XMax and YMax aren't.

Public Members

`PLFilterCrop(int XMin, int YMin, int XMax, int YMax);` `virtual ~PLFilterCrop();` `virtual void Apply(PLBmp * pBmpSource, PLBmp * pBmpDest) const;`

PLFilterFill

    #include "plfilterfill.h"

Derived from: public PLFilter

Fills a 32 bpp Bitmap completely with a color.

PLFilterFlip

    #include "plfilterflip.h"

Derived from: public PLFilter

Flips a 32 bpp bitmap upside-down

Public Members

`PLFilterFlip();` `virtual ~PLFilterFlip();` `virtual void Apply(PLBmp * pBmpSource, PLBmp * pBmpDest) const;`

PLFilterGetAlpha

    #include "plfiltergetalpha.h"

Derived from: public PLFilter

Returns an 8 bpp grayscale bitmap containing only the alpha channel of the source bitmap.

Public Members

`PLFilterGetAlpha();` `virtual ~PLFilterGetAlpha();` `virtual void Apply(PLBmp * pBmpSource, PLBmp * pBmpDest) const;`

PLFilterGrayscale

    #include "plfiltergrayscale.h"

Derived from: public PLFilter

Creates a grayscale version of a 32 bpp bitmap.

Public Members

`PLFilterGrayscale();` `virtual ~PLFilterGrayscale();` `virtual void Apply(PLBmp * pBmpSource, PLBmp * pBmpDest) const;`

PLFilterIntensity

    #include "plfilterintensity.h"

Derived from: public PLFilter

Changes the intensity of a 24 or 32 bpp bitmap. Applies the factor intensityFactor = 1.0 + csupp * pow((v-m_offset), m_exponent) with csupp = intensity/pow(255.0, m_exponent); on the v-Value of the image after a HSV transform. The bitmap stays unchanged for intensity = 20, offset = 128, exponent = 1.

PLFilterLightness

    #include "plfilterlightness.h"

Derived from: public PLFilter

Filter that changes the lightness of a 32 bpp bitmap. lightness values must be in the range -100..100. A value of 0 leaves the image unchanged.

Public Members

`PLFilterLightness (int lightness);` `virtual ~PLFilterLightness();` `virtual void Apply(PLBmp *pBmpSource, PLBmp* pBmpDest) const;`

PLFilterMirror

    #include "plfiltermirror.h"

Derived from: public PLFilter

Creates a mirror image of a bitmap.

Public Members

`PLFilterMirror();` `virtual ~PLFilterMirror();` `virtual void Apply(PLBmp * pBmpSource, PLBmp * pBmpDest) const;`

PLFilterQuantize

    #include "plfilterquantize.h"

Derived from: public PLFilter

Returns an 8 bpp bitmap containing a best-fit representation of the source 32 bpp bitmap.

Public Members

`PLFilterQuantize (int DitherPaletteType, int DitherType);`

DitherPaletteType and DitherType determine the type of quantization:

PLDTHPAL_MEDIAN (0): Median cut

PLDTHPAL_POPULARITY (1): Popularity sort

PLDTHPAL_DEFAULT (2): Use default palette

PLDTHPAL_USERDEFINED (3): Use palette defined by SetUserPalette();

PLDTH_NONE (0): No dithering

PLDTH_ORDERED (1): Ordered dithering

PLDTH_FS (2): Floyd-Steinberg dithering
`virtual ~PLFilterQuantize();`
`virtual void Apply(PLBmp * pBmpSource, PLBmp * pBmpDest) const;`
`void SetUserPalette(const PLPixel32* pPal);`

For PLDTHPAL_USERDEFINED, sets the palette to use

PLFilterResize

    #include "plfilterresize.h"

Derived from: public PLFilter

Base class for filters that resize the image.

Public Members

`PLFilterResize(int NewXSize, int NewYSize);` `virtual ~PLFilterResize();` `void SetNewSize(int NewXSize, int NewYSize);`

PLFilterResizeBilinear

    #include "plfilterresizebilinear.h"

Derived from: public PLFilterResize

Resizes a 32 bpp bitmap using bilinear interpolation. This is the best-optimized of the resize filters.

Public Members

`PLFilterResizeBilinear (int NewXSize, int NewYSize);` `virtual void Apply(PLBmp * pBmpSource, PLBmp * pBmpDest) const;`

PLFilterResizeBox

    #include "plfilterresizebox.h"

Derived from: public PLFilterResize

Resizes a 32 bpp bitmap using a box filter to calculate results.

Public Members

`PLFilterResizeBox (int NewXSize, int NewYSize);` `virtual void Apply(PLBmp * pBmpSource, PLBmp * pBmpDest) const;`

PLFilterResizeGaussian

    #include "plfilterresizegaussian.h"

Derived from: public PLFilterResize

Resizes a 32 bpp bitmap using a gaussian filter to determine result pixels.

Public Members

`PLFilterResizeGaussian (int NewXSize, int NewYSize, double NewRadius);` `virtual void Apply(PLBmp * pBmpSource, PLBmp * pBmpDest) const;`

PLFilterResizeHamming

    #include "plfilterresizehamming.h"

Derived from: public PLFilterResize

Resizes a 32 bpp bitmap using a hamming filter to determine result pixels.

Public Members

`PLFilterResizeHamming (int NewXSize, int NewYSize, double NewRadius);` `virtual void Apply(PLBmp * pBmpSource, PLBmp * pBmpDest) const;`

PLFilterThreshold

    #include "plfilterthreshold.h"

Derived from: public PLFilter

Returns an 8 bpp grayscale bitmap that contains only the channel selected and is black wherever this channel has values <= threshold_min or >= threshold_max.

Public Members

`PLFilterThreshold(int threshold_min,int threshold_max, int channel);` `virtual ~PLFilterThreshold();` `virtual void Apply(PLBmp * pBmpSource, PLBmp * pBmpDest) const;`

PLFilterVideoInvert

    #include "plfiltervideoinvert.h"

Derived from: public PLFilter

Public Members

`PLFilterVideoInvert();` `virtual ~PLFilterVideoInvert();` `void Apply(PLBmp * pBmpSource, PLBmp * pBmpDest) const;`

PLIProgressNotification

    #include "plprognot.h"

Defines an interface for progress notifications.

Public Members

`virtual void OnProgress ( double Part ) = 0;` Called during decoding as progress gets made.

PLJPEGDecoder

    #include "pljpegdec.h"

Derived from: public PLPicDecoder

JPEG file decoder. Uses the independent JPEG group's library to do the actual conversion.

Public Members

`PLJPEGDecoder ();`

Creates a decoder
`~PLJPEGDecoder ();`

Destroys a decoder
`void SetFast ( bool bFast );`

true (the default) selects fast but sloppy decoding.
`static void JNotification (j_common_ptr cinfo );`

callback for jpeglib's progress notification

Protected Members

`void DoDecode ( PLBmp * pBmp, PLDataSource * pDataSrc );` Sets up the jpeg library data source and error handler and calls the jpeg decoder.

PLJPEGEncoder

    #include "pljpegenc.h"

Derived from: public PLPicEncoder

JPEG file encoder. Uses the independent JPEG group's library to do the actual conversion.

Public Members

`PLJPEGEncoder ();`

Creates an encoder
`~PLJPEGEncoder ();`

Destroys a encoder
`void SetQuality(int iQuality);`

Set the compression quality on a scale from 0 to 100.
`void SetOptimizeCoding(bool bOptimizeCoding);`

Enable or disable the generation of optimal Huffmann coding tables.
`void SetSmoothingFactor(int iSmoothingFactor);`

Set the smoothing factor (<=100). 0 turns it off.
`void SetDensity(unsigned int uiX, unsigned int uiY);`

Set the resolution information (DPI) for the image.

PLMemSink

    #include "plmemsink.h"

Derived from: public PLDataSink

This is a class which takes a memory region as a destination of picture data.

Public Members

`PLMemSink ();` `virtual ~PLMemSink ();` `virtual int Open ( const char * pszFName, int MaxFileSize );` `virtual void Close ();`

PLMemSource

    #include "plmemsrc.h"

Derived from: public PLDataSource

This is a class which takes a memory pointer as a source of picture data.

Public Members

`PLMemSource ();`
`virtual ~PLMemSource ();`
`virtual int Open( unsigned char *pek, int size);`
`virtual void Close ();`
`virtual PLBYTE * GetBufferPtr ( int MinBytesInBuffer );`

Read but don't advance file pointer.
`virtual PLBYTE * ReadEverything ();`

This is a legacy routine that interferes with progress notifications. Don't call it!

PLPCXDecoder

    #include "plpcxdec.h"

Derived from: public PLPicDecoder

PCX file decoder. Decodes 8, 15, 16, 24 and 32 bpp PCX files (compressed and uncompressed) and returns an 8 or 32 bpp CBitmap. Preserves the alpha channel.

Public Members

`PLPCXDecoder();` Creates a decoder `virtual ~PLPCXDecoder ();` Destroys a decoder

Protected Members

`virtual void DoDecode (PLBmp * pBmp, PLDataSource * pDataSrc);` Main decoder routine. Reads the header, Creates the bitmap, reads the palette, and reads the image data.

PLPGMDecoder

    #include "plpgmdec.h"

Derived from: public PLPicDecoder

Portable Graymap file decoder. Delivers an 8 bpp grayscale image.

Public Members

`PLPGMDecoder ();` Creates a decoder `virtual ~PLPGMDecoder ();` Destroys a decoder

Protected Members

`virtual void DoDecode ( PLBmp * pBmp, PLDataSource * pDataSrc );` Main decoder routine. Reads the header, Creates the bitmap, reads the palette, and reads the image data.

PLPNGDecoder

    #include "plpngdec.h"

Derived from: public PLPicDecoder

PNG file decoder. Uses LibPng to do the actual decoding. PNG supports many pixel formats not supported by paintlib. These pixel formats are converted to the nearest paintlib equivalent. Images with less or more than 8 bits per channel are converted to 8 bits per channel. Images with 16-bit palettes or grayscale images with an alpha channel are returned as full 32-bit RGBA bitmaps.

Public Members

`PLPNGDecoder ();` Creates a decoder `virtual ~PLPNGDecoder ();` Destroys a decoder

Protected Members

`virtual void DoDecode ( PLBmp * pBmp, PLDataSource * pDataSrc );` Main decoder routine. Reads the header, creates the bitmap, reads the palette, and reads the image data.

PLPNGEncoder

    #include "plpngenc.h"

Derived from: public PLPicEncoder

PNG file encoder. Uses LIBPNG to do the actual conversion.

Public Members

`PLPNGEncoder ();` Creates an encoder `virtual ~PLPNGEncoder ();` Destroys a encoder

Protected Members

`virtual void DoEncode ( PLBmp* pBmp, PLDataSink* pDataSnk );` Sets up LIBPNG environment and calls LIBPNG to encode an image.

PLPPMDecoder

    #include "plppmdec.h"

Derived from: public PLPicDecoder

Portable Pixmap file decoder. Delivers a 24 bit true color image.

Public Members

`PLPPMDecoder ();` Creates a decoder `virtual ~PLPPMDecoder ();` Destroys a decoder

Protected Members

`virtual void DoDecode ( PLBmp * pBmp, PLDataSource * pDataSrc );` Main decoder routine. Reads the header, Creates the bitmap, reads the palette, and reads the image data.

PLPSDDecoder

    #include "plpsddec.h"

Derived from: public PLPicDecoder

Photoshop file decoder. Besides having the MakeBmpFromFile interface that the other decoders have, the photoshop decoder loads the layers of the image into separate bitmaps so they can be manipulated separately:

       vector Bmp;
       PLAnyBmp BaseBmp);
       Decoder->OpenFile ("face.psd");
       int NumLayers = Decoder->GetNumLayers();
       for (int i=0; i
    Public Members

     PLPSDDecoder ();

     Creates a decoder

     virtual ~PLPSDDecoder ();

     Destroys a decoder

     int GetNumLayers ();

     Returns number of layers in the image.

     void GetNextLayer ( PLBmp& Bmp );

     Fills the bitmap with the layer data.

     PLPoint GetLayerOffset ();

     Returns the origin of the layer data in the image.

     void GetImage ( PLBmp& Bmp );

     Fills the bitmap with the main image. This image is a flattened
     version of the layers.

    Protected Members

     virtual void DoDecode ( PLBmp * pBmp, PLDataSource * pDataSrc );

     Main decoder routine. Reads the header, Creates the bitmap,
     reads the palette, and reads the image data.

    PLPicDecoder

    #include "plpicdec.h"

    Derived from:  public PLObject

     PLPicDecoder is an abstract base class. It defines common routines
     for all decoders. Decoders for specific file formats can be
     derived from this class. Objects of this class interact with a
     PLDataSource to decode bitmaps.

    Public Members

     PLPicDecoder ();

     Empty constructor. The actual initialization takes place in a
     derived class.

     virtual ~PLPicDecoder ();

     Destructor. Frees memory allocated.

     virtual void MakeBmpFromFile ( const char * pszFName, PLBmp * pBmp, int BPPWanted = 0, PLIProgressNotification * pProgNot = NULL );

     Decodes a picture in a file and stores the results in pBmp.
     BPPWanted is the number of bits per pixel in the bitmap
     returned. Valid values for BPPWanted are 8, 24, and 0.
     0 means 'keep the input format'. Decoding a true-color image
     to 8 bpp is not supported. As an exception, BPPWanted can be
     1 for b/w tiff files.

     virtual void MakeBmpFromResource ( HINSTANCE hInstResource, int ResourceID, PLBmp * pBmp, int BPPWanted = 0, const char* ResType = NULL, HMODULE hResModule = 0 );

     Decodes a picture in a resource by creating a resource data
     source and calling MakeBmp with this data source.
     BPPWanted is the number of bits per pixel in the bitmap
     returned. Valid values for BPPWanted are 8, 24, and 0.
     0 means 'keep the input format'. Decoding a true-color image
     to 8 bpp is not supported. As an exception, BPPWanted can be
     1 for b/w tiff files.
     ResType is the windows resource type (e.g. "JPEG") to be used.

     New optional parameter: hResModule (04.01.2000 ms)
     If a module handle is passed as hResModule, then the resource
     will be loaded from this module, otherwise, the resource
     will be searched for by AfxFindResourceHandle (! MFC dependent!)

     virtual void PLPicDecoder::MakeBmpFromMemory ( unsigned char * ucMemSrc, int MemSrcSize, PLBmp * pBmp, int BPPWanted = 0, PLIProgressNotification * pProgNot = NULL );

     Decodes a picture from a memory location which directly resembles
     the image file as it would be on disc. The result is stored in pBmp.
     BPPWanted is the number of bits per pixel in the bitmap
     returned. Valid values for BPPWanted are 8, 24, and 0.
     0 means 'keep the input format'. Decoding a true-color image
     to 8 bpp is not supported. As an exception, BPPWanted can be
     1 for b/w tiff files.

     virtual void MakeBmp ( PLDataSource * pDataSrc, PLBmp * pBmp, int BPPWanted = 0 );

     Decodes a picture by getting the encoded data from pDataSrc.
     Stores the results in pBmp. BPPWanted is the number of bits
     per pixel in the bitmap returned. Valid values for BPPWanted
     are 8, 24, and 0. 0 means 'keep the input format'. Decoding a
     true-color image to 8 bpp is not supported.

     static void SetTraceConfig ( int Level, char * pszFName );

     Sets the amount and destination of debug traces output by the
     debug version. pszFName contains either a valid file name or is
     NULL. If it contains a file name, this file is used to store
     debug information. If pszFName is NULL, the destination is
     either the MSVC debug console or stderr depending on the
     version of the library. Valid values for Level are:

     0: Trace only errors.

     1: Trace top-level calls.

     2: Trace picture format information

     3: Trace all miscellaneous info.

     The trace configuration is global to all decoders.

     static void Trace ( int TraceLevel, const char * pszMessage );

     Called to output status messages to the current debug console

    Protected Members

     virtual void DoDecode ( PLBmp * pBmp, PLDataSource * pDataSrc );

     Implements the actual decoding process. Uses variables local to
     the object to retrieve and store the data. Implemented in
     derived classes.

     This routine should never be called. It's here so derived classes
     can override MakeDIB directly if they want to. (CAnyDecoder does
     this).

    PLPicEncoder

    #include "plpicenc.h"

    Derived from:  public PLObject

     PLPicEncoder is an abstract base class. It defines common routines
     for all encoders. Encoders for specific file formats can be
     derived from this class. Objects of this class interact with a
     PLDataSink to encode bitmaps.

    Public Members

     PLPicEncoder ();

     Empty constructor. The actual initialization takes place in a
     derived class.

     virtual ~PLPicEncoder ();

     Destructor. Frees memory allocated.

     virtual void MakeFileFromBmp( const char *, PLBmp* );

     Encodes a bitmap to a file and stores.

     virtual void SaveBmp( PLBmp*, PLDataSink* );

     Encodes a picture to a pre-existing data destination (sink).

    Protected Members

     virtual void DoEncode ( PLBmp* pBmp, PLDataSink* pDataSrc ) = 0;

     Implements the actual encoding process. Uses variables local to the
     object to retrieve and store the data. Implemented in derived classes.

    PLPictDecoder

    #include "plpictdec.h"

    Derived from:  public PLPicDecoder

     This class decodes macintosh PICT files with 1,2,4,8,16 and 32
     bits per pixel as well as PICT/JPEG. If an alpha channel is
     present in a 32-bit-PICT, it is decoded as well.
     The PICT format is a general picture file format and can
     contain a lot of other elements besides bitmaps. These elements
     are ignored.

    Public Members

     PLPictDecoder ( PLJPEGDecoder * pJPEGDecoder );

     Creates a decoder. A JPEG decoder is needed to decode PICT
     files containing JPEGs.

     virtual ~PLPictDecoder ();

     Destroys a decoder.

    Protected Members

     virtual void DoDecode ( PLBmp * pBmp, PLDataSource * pDataSrc );

     Does the actual decoding after a data source has been set up.

    PLPixel24

    #include "plpixel24.h"

     24 bit pixel class. A pixel in this class contains 8 bits each of
     red, green and blue. The order of the color components is
     OS-dependent and defined in config.h. This class is meant to be
     fast, so all methods are inlined.

    Public Members

     PLPixel24 ();

     PLPixel24 (PLBYTE r, PLBYTE g, PLBYTE b);

     void Set (PLBYTE r, PLBYTE g, PLBYTE b);

     void SetR (PLBYTE r);

     void SetG (PLBYTE g);

     void SetB (PLBYTE b);

     PLBYTE GetR () const;

     PLBYTE GetG () const;

     PLBYTE GetB () const;

     PLPixel24 operator = (const PLPixel32 Pix);

     bool operator ==(const PLPixel24&) const;

     bool operator !=(const PLPixel24&) const;

     int BoxDist (const PLPixel24 Pix) const;

     Simple and fast 'distance' between two pixels. Just adds the
     distances between the color components and treats colors
     equally.

     static PLPixel24 Blend (int Factor, const PLPixel24 Pix1, const PLPixel24 Pix2);

     Returns a weighed average between two pixels. Factor must be
     between 0 and 256. Factor=256 means Pix1 is the result, Factor=0
     means Pix2 is the result.

    PLPixel32

    #include "plpixel32.h"

     32 bit pixel class. A pixel in this class contains 8 bits each of
     red, green, blue and alpha. The order of the color components is
     OS-dependent and defined in config.h. This class is meant to be
     fast, so all methods are inlined.

    Public Members

     PLPixel32 ();

     PLPixel32 (PLBYTE r, PLBYTE g, PLBYTE b, PLBYTE a);

     PLPixel32 (PLBYTE r, PLBYTE g, PLBYTE b);

     void Set (PLBYTE r, PLBYTE g, PLBYTE b, PLBYTE a);

     void Set (PLBYTE r, PLBYTE g, PLBYTE b);

     void SetR (PLBYTE r);

     void SetG (PLBYTE g);

     void SetB (PLBYTE b);

     void SetA (PLBYTE a);

     PLBYTE GetR () const;

     PLBYTE GetG () const;

     PLBYTE GetB () const;

     PLBYTE GetA () const;

     bool operator ==(const PLPixel32 Pix) const;

     bool operator !=(const PLPixel32 Pix) const;

     int BoxDist (const PLPixel32 Pix) const;

     Simple and fast 'distance' between two pixels. Just adds the
     distances between the color components and treats colors
     equally.

     static PLPixel32 Blend (int Factor, const PLPixel32 Pix1, const PLPixel32 Pix2);

     Returns a weighed average between two pixels. Factor must be
     between 0 and 256. Factor=256 means Pix1 is the result, Factor=0
     means Pix2 is the result.

    PLPixel8

    #include "plpixel8.h"

     8 bit pixel class. A pixel in this class contains 8 bits of
     image data. This class is meant to be
     fast, so all methods are inlined.

    Public Members

     PLPixel8 ();

     PLPixel8 (PLBYTE val);

     void Set (PLBYTE val);

     PLBYTE Get () const;

     bool operator ==(const PLPixel8&);

     bool operator !=(const PLPixel8&);

     int BoxDist (PLPixel8 Pix);

     Simple and fast 'distance' between two pixels.

    PLPoint

    #include "plpoint.h"

     Simple point class for 2d coordinate manipulations. This class
     contains only inline functions and nothing virtual. Its member variables
     are public.

    Public Members

     PLPoint ();

     PLPoint ( int X, int Y );

     bool operator == ( const PLPoint & pt ) const;

     bool operator != ( const PLPoint & pt ) const;

     void operator += ( const PLPoint & pt );

     void operator -= ( const PLPoint & pt );

     PLPoint operator - () const;

     PLPoint operator + ( const PLPoint & pt ) const;

     PLPoint operator - ( const PLPoint & pt ) const;

     PLPoint operator / ( double f ) const;

    PLRect

    #include "plrect.h"

    Public Members

     PLRect ();

     PLRect ( int left, int top, int right, int bottom );

     PLRect ( const PLPoint& TL, const PLPoint& BR );

     bool operator == ( const PLRect & rect ) const;

     bool operator != ( const PLRect & rect ) const;

     int Width () const;

     int Height () const;

    PLResourceSource

    #include "plressrc.h"

    Derived from:  public PLDataSource

     This is a class which takes a windows resource as a source of
     picture data.

    Public Members

     PLResourceSource ();

     virtual ~PLResourceSource ();

     virtual int Open ( HINSTANCE lh_ResInst, int ResourceID, const char * pResType = NULL );

     virtual void Close ();

     virtual PLBYTE * GetBufferPtr ( int MinBytesInBuffer );

     Read but don't advance file pointer.

     virtual PLBYTE * ReadEverything ();

     This is a legacy routine that interferes with progress notifications.
     Don't call it!

    PLStreamSink

    #include "plStreamSink.h"

    Derived from:  public PLDataSink

    Public Members

     virtual int Open ( int MaxFileSize );

     virtual void Close ();

    PLTGADecoder

    #include "pltgadec.h"

    Derived from:  public PLPicDecoder

     Targa file decoder. Decodes 8, 15, 16, 24 and 32 bpp
     targa files (compressed and uncompressed) and returns an 8 or 32
     bpp CBitmap. Preserves the alpha channel.

    Public Members

     PLTGADecoder ();

     Creates a decoder

     virtual ~PLTGADecoder ();

     Destroys a decoder

    Protected Members

     virtual void DoDecode ( PLBmp * pBmp, PLDataSource * pDataSrc );

     Main decoder routine. Reads the header, Creates the bitmap,
     reads the palette, and reads the image data.

    PLTIFFDecoder

    #include "pltiffdec.h"

    Derived from:  public PLPicDecoder

     TIFF file decoder. Uses LIBTIFF to do the actual conversion.
     Supports 1, 8 and 24 bits per pixel as output formats.

    Public Members

     PLTIFFDecoder ();

     Creates a decoder

     virtual ~PLTIFFDecoder ();

     Destroys a decoder

    Protected Members

     virtual void DoDecode ( PLBmp * pBmp, PLDataSource * pDataSrc );

     Sets up LIBTIFF environment and calls LIBTIFF to decode an
     image.

    PLTIFFDecoderEx

    #include "pltiffdecex.h"

    Derived from:  public PLTIFFDecoder

     Modest interface to get access to tagged fields
     This should move to CTiffDecoder but I dare not re-introduce
     data members in the reworked thread-safe base decoder

    Public Members

     TIFF* GetTIFFHandle();

     this is this first argument to most libtiff's routines
     use at your own risk; you've been warned!

    PLTIFFEncoder

    #include "pltiffenc.h"

    Derived from:  public PLPicEncoder

     TIFF file encoder. Uses LIBTIFF to do the actual conversion.

    Public Members

     PLTIFFEncoder ();

     Creates an encoder

     virtual ~PLTIFFEncoder ();

     Destroys a encoder

    Protected Members

     virtual void DoEncode ( PLBmp* pBmp, PLDataSink* pDataSnk );

     Sets up LIBTIFF environment and calls LIBTIFF to encode an image.

     virtual void DoTiffEncode ( PLBmp* pBmp, TIFF* tif );

     this one mostly useful for the "extended" decoder

     int SetBaseTags( TIFF*, PLBmp* );

     According to the characteristics of the given bitmap,
     set the baseline tags

     int SetField( TIFF*, int tag_id, ... );

     Set tag value in directory; also, "pseudo-tags" are interpreted by
     LIBTIFF as modifiers to certain algorithms (compression....).
     We do _not_ support multiple images by file, nor tiling nor stripping.

    PLTIFFEncoderEx

    #include "pltiffencex.h"

    Derived from:  public PLTIFFEncoder

     Basic tiff output is available via "PLTIFFEncoder::MakeFileFromBmp()".
     This does not compress data or allow any informative tag to be set.
     For those who need greater control, PLTIFFDecoderEx is provided.

    Public Members

     PLTIFFEncoderEx();

     Creates an encoder

     virtual ~PLTIFFEncoderEx();

     Destroys an encoder

     bool Associate( PLDataSink* );

     Bind DataSink to Encoder (the link is the TIFF* member)

     void Dissociate( void );

     Flush the output

     int SetBaseTags( PLBmp* );

     SetBaseTabs and SetField make their base class equivalent usable,
     without requiring the user to know about the libtiff internals (TIFF*)

     int SetField( int tag_id, ... );

     SetBaseTabs and SetField make their base class equivalent usable,
     without requiring the user to know about the libtiff internals (TIFF*)

    Protected Members

     virtual void DoEncode( PLBmp*, PLDataSink* = 0 );

     Sets up LIBTIFF environment and calls LIBTIFF to encode an image.

    PLTextException

    #include "plexcept.h"

    Derived from:  public PLObject

     An object of this class is thrown by other classes when an error
     occurs. It contains an error code and a string describing the
     error. The error code is meant to be used internally in the
     program; the descriptive string can be output to the user. Error
     codes and strings do not correspond 1:1. The strings are more
     precise.

    Public Members

     PLTextException ( int Code, const char * pszErr );

     Creates an exception.

     PLTextException ( const PLTextException& ex );

     Copy constructor.

     virtual ~PLTextException ();

     Destroys an exception

     virtual int GetCode () const;

     Returns the code of the error that caused the exception. Valid
     error codes are:

     PL_ERRWRONG_SIGNATURE (1): Expected file signature not found.

     PL_ERRFORMAT_UNKNOWN (2): Unexpected data encountered. This
     probably indicates a corrupt file or an unknown file
     sub-format.

     PL_ERRPATH_NOT_FOUND (3), PL_ERRFILE_NOT_FOUND (4),
     PL_ERRACCESS_DENIED (5): Problems with the file system.

     PL_ERRFORMAT_NOT_PL_SUPPORTED (6): Known but unsupported format.

     PL_ERRINTERNAL (7): Kaputt. Tell me about it.

     PL_ERRUNKNOWN_FILE_TYPE (8): Couldn't recognize the file type.

     PL_ERRDIB_TOO_LARGE (9): Maximum size for 1 bmp was exceeded.
     (See MAX_BITMAP_SIZE above for an explanation).

     PL_ERRNO_MEMORY (10): Out of memory.

     PL_ERREND_OF_FILE (11): End of file reached before end of image.

     virtual operator const char * () const;

     This operator allows the exception to be treated as a string
     whenever needed. The string contains the error message.

    PLWEMFDecoder

    #include "plwemfdec.h"

    Derived from:  public PLPicDecoder

     Decoder for 16-Bit Windows Metafiles (*.wmf) and 16-Bit Adobe
     Placeable Metafiles (*,wmf) and 32-Bit Enhanced Windows
     Metafiles (*.emf) for Windows 95, Windows 98 and Windows NT
     >= 3.1.

     Comments by the author, Mario Westphal:

       It can handle at least the 500 tested images I've got
       from various free and commercial clipart sources. If
       you find a WMF/EMF file it cannot handle, attach it to
       an email and send it to mw@mwlabs.de. I'll see what I
       can do. But, please, test it with another program
       before you send itin to see if it is really a valid
       metafile.

    Public Members

     PLWEMFDecoder();

     virtual ~PLWEMFDecoder();

    Protected Members

     virtual void DoDecode(PLBmp * pBmp, PLDataSource* pDataSrc);

    PLWinBmp

    #include "plwinbmp.h"

    Derived from:  public PLBmp

     This is the windows version of PLBmp. The internal storage format
     is a windows DIB. It supports all color depths allowed by
     windows: 1, 4, 8, 16, 24, and 32 bpp. The bits are always accessible:
     m_LockCount is always > 0 and IsLocked always returns true.

     The subset of the windows DIB format supported is as follows: The
     DIB is stored so that header, palette, and bits are in one
     buffer. The bottom line is stored first (biHeight must be > 0)
     and the data is uncompressed (BI_RGB). Color tables for 16, 24,
     and 32 bpp are not supported. biClrUsed is always 0. The palette
     mode is DIB_RGB_COLORS. DIB_PAL_COLORS is not supported.

     Note that almost all real-life DIBs conform to this subset
     anyway, so there shouldn't be any problems.

     In the current version, some functions (notably CreateCopy) only
     support 1, 8 and 32 bpp. Sorry!

    Public Members

     PLWinBmp ( const PLWinBmp &Orig );

     Copy constructor

     PLWinBmp ( const PLBmp &Orig );

     Copy constructor

     virtual ~PLWinBmp ();

     Destroys the bitmap.

     PLWinBmp &operator= (PLBmp const &Orig);

     Assignment operator.

     PLWinBmp &operator= (PLWinBmp const &Orig);

     Assignment operator.

     virtual long GetMemUsed ();

     Returns the amount of memory used by the object.

     virtual long GetBytesPerLine ();

     Returns number of bytes used per line.

     virtual void CreateRes (HINSTANCE lh_ResInst, int ID);

     Loads a bitmap from a windows resource (.rc or .res linked to
     the exe). Fails if the bitmap is compressed.

     void CreateFromHBitmap (HBITMAP hBitMap);

     Takes a HBITMAP and converts it to a PLWinBmp.

     void CreateFromHDIBBitmap(BITMAPINFOHEADER* pBIH, HPALETTE hPal = NULL);

     Takes an existing device-independent bitmap and converts it
     to a PLWinBmp.

     SIZE GetSize ();

     Returns the size of the bitmap in pixels

     BITMAPINFOHEADER * GetBMI ();

     Access the windows bitmap structure. Using this structure, all
     standard DIB manipulations can be performed.

     virtual void Draw (HDC hDC, int x, int y, DWORD rop = SRCCOPY);

     Draws the bitmap on the given device context using
     StretchDIBits.

     virtual void StretchDraw (HDC hDC, int x, int y, double Factor, DWORD rop = SRCCOPY);

     Draws the bitmap on the given device context using
     StretchDIBits. Scales the bitmap by Factor.

     virtual void StretchDraw (HDC hDC, int x, int y, int w, int h, DWORD rop = SRCCOPY);

     Draws the bitmap on the given device context using
     StretchDIBits. Scales the bitmap so w is the width and
     h the height.

     virtual BOOL DrawExtract (HDC hDC, POINT pntDest, RECT rcSrc);

     Draws a portion of the bitmap on the given device context

     void ToClipboard ();

     Puts a copy of the bitmap in the clipboard

     bool FromClipboard (UINT uFormat = CF_BITMAP);

     Reads the clipboard into the bitmap. uFormat can be either
     CF_BITMAP or CF_DIB.

     BYTE * GetBits ();

     Gets a pointer to the bitmap bits. (Usually, using GetLineArray()
     is much easier!)

     void CopyPalette (PLWinBmp * pSrPLBmp);

     Copies the palette over from pSrPLBmp.

     void TracePalette();

     Traces the values in the palette via PLTRACE();

     static long GetMemNeeded (LONG width, LONG height, WORD BitsPerPixel);

     Returns memory needed by a bitmap with the specified attributes.

     static long GetBitsMemNeeded (LONG width, LONG height, WORD BitsPerPixel);

     Returns memory needed by bitmap bits.

     static int GetLineMemNeeded (LONG width, WORD BitsPerPixel);

     Returns memory needed by one line.

    Protected Members

     virtual void internalCreate (LONG Width, LONG Height, WORD BitsPerPixel, bool bAlphaChannel);

     Create a new empty DIB. Bits are uninitialized.
     Assumes that no memory is allocated before the call.

     virtual void internalCreate (BITMAPINFOHEADER* pBMI);

     Creates a PLWinBmp from an existing bitmap pointer.
     Assumes that no memory is allocated before the call.

     virtual void freeMembers ();

     Deletes memory allocated by member variables.

     virtual void initLineArray ();

     Initializes internal table of line addresses.

    Globals

    #include "jmemdest.h"

     Defines a custom data source for LIBJPEG

    #include "jmemsrc.h"

     Defines a custom data source for LIBJPEG

    #include "plbitmap.h"

    PL_RGBA_BLUE, PL_RGBA_GREEN, PL_RGBA_RED, and PL_RGBA_ALPHA

    These constants define the order of the channels in an image.
    To reference a particular channel in a pixel, add one of these
    constants to the pixel address. The constants can be changed if
    nessesary to change the channel ordering. The contents of PL_RGBA_ALPHA
    are only valid if HasAlpha() is TRUE.

    PL_PIXEL_BGRA_ORDER

    If this is defined, the PL_RGBA_XXX constants are defined so that their
    ordering is equal to the ordering that windows expects.

    PL_PIXEL_RGBA_ORDER

    If this is defined, the PL_RGBA_XXX constants are defined so that red is
    first.

    #include "ploptable.h"

     Table of the first 200 or so PICT opcodes with size & description.
     Mostly stolen from pict2pbm. I hope they don't mind.

    #include "plpaintlibdefs.h"

     Contains common datatype definitions.

    #include "plpgm.h"

     Defines structures and constants present in PGM files.

    #include "plppm.h"

     Defines structures and constants present in PGM files.

    #include "plstdpch.h"

     Contains most system-specific includes and definitions. On windows
     systems, it corresponds to stdafx.h. On other systems, the
     appropriate data types and macros are declared here.
    BYTE

8 bits of unsigned data.

    WORD

An unsigned integer with 16 bits. Due to windows madness, this is not nessesarily the size of a machine word!

    LONG

A signed 32-bit integer.

    ULONG

An unsigned 32-bit integer.

    PLTRACE (char * pszFormat, ...);

In the debug version (_DEBUG defined), this macro outputs a string to the current debug console. In the release version, it expands to nothing. The parameters correspond to those of printf.

    PLASSERT (BOOL b);

This is an assert for debug purposes. In the debug version (_DEBUG defined), it causes a program halt if b is FALSE. In the release version, nothing is done. (Note: The parameter is not evaluated in release mode, so constructs like ASSERT (pF = fopen ("bla")) will not do what is expected.)

    #include "pltga.h"

Defines structures and constants present in TGA files.

    #include "plwindefs.h"

Windows Bitmap Struct Definitions Contains the definitions for the data structures used in windows bitmap files. For windows apps, they are already defined - but not with these names. The WINRGBQUAD, WINBITMAPFILEHEADER, WINBITMAPINFOHEADER, and WINBITMAPINFO structs are defined as RGBQUAD etc. in the windows header files. See the windows documentation for details.

    #include "qdraw.h"

This file defines the data structures used in pict files. They correspond to the appropriate MAC QuickDraw structs. See QuickDraw docs for an explanation of these structs.

    #include "tif_msrc.h"

Custom data source for libtiff. Assumes all data is in memory at start.