Public Member Functions

Quantizer Class Reference

Search for all occurrences

Detailed Description

See also:
Structure BMM_Color_64, Structure BMM_Color_48, Structure BMM_Color_24.

Description:
Color quantizer, for doing true-color to paletted conversion. All methods of this class are implemented by the system. Create a Quantizer object by calling:

Quantizer *BMMNewQuantizer();

Be sure to call Quantizer::DeleteThis() when done.

#include <palutil.h>

Inheritance diagram for Quantizer:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual  ~Quantizer ()
virtual int  AllocHistogram (void)=0
virtual int  Partition (BMM_Color_48 *pal, int palsize, BMM_Color_64 *forceCol)=0
virtual void  AddToHistogram (BMM_Color_64 *image, int npix)=0
virtual void  AddToHistogram (BMM_Color_48 *image, int npix)=0
virtual void  AddToHistogram (BMM_Color_24 *image, int npix)=0
virtual void  DeleteThis ()=0

Constructor & Destructor Documentation

virtual ~Quantizer ( ) [inline, virtual]
Remarks:
Destructor.
{}

Member Function Documentation

virtual int AllocHistogram ( void  ) [pure virtual]
Remarks:
This method allocates the histogram used in doing the conversion.
Returns:
Nonzero if the histogram was allocated; otherwise zero.
virtual int Partition ( BMM_Color_48 pal,
int  palsize,
BMM_Color_64 forceCol 
) [pure virtual]
Remarks:
This method uses the histogram and computes the palette.
Parameters:
BMM_Color_48 *pal

Storage for the palette to compute.

int palsize

The size of the palette.

BMM_Color_64 *forceCol

If there is a color that you want to make sure is available in the palette, you may pass it here. This is used for the background color of an image for example. If this is not NULL the quantizer will make up a palette and make sure that this color is in it. For backgrounds, this looks much nicer because the background won't be dithered when shown using the palette.
Returns:
Nonzero if the palette was computed; otherwise zero.
virtual void AddToHistogram ( BMM_Color_64 image,
int  npix 
) [pure virtual]
Remarks:
Adds the specified colors to the histogram so they are taken into account in the palette computations.
Parameters:
BMM_Color_64 *image

The pixels to include.

int npix

The number of pixels above.
virtual void AddToHistogram ( BMM_Color_48 image,
int  npix 
) [pure virtual]
Remarks:
Adds the specified colors to the histogram so they are taken into account in the palette computations.
Parameters:
BMM_Color_48 *image

The pixels to include.

int npix

The number of pixels above.
virtual void AddToHistogram ( BMM_Color_24 image,
int  npix 
) [pure virtual]
Remarks:
Adds the specified colors to the histogram so they are taken into account in the palette computations.
Parameters:
BMM_Color_24 *image

The pixels to include.

int npix

The number of pixels above.
virtual void DeleteThis ( ) [pure virtual]
Remarks:
This method is called to delete the Quantizer when you are done with it.

Quantizer Quantizer Quantizer Quantizer Quantizer Quantizer Quantizer Quantizer Quantizer Quantizer
Quantizer Quantizer Quantizer Quantizer Quantizer Quantizer Quantizer Quantizer Quantizer Quantizer