Class Quantizer

3DS Max Plug-In SDK

Class Quantizer

See Also: BMM_Color_64, BMM_Color_48, BMM_Color_24.

class Quantizer

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.

Methods:

Prototype:

virtual int Partition(BMM_Color_48 *pal, int palsize, BMM_Color_64 *forceCol)=0;

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.

Return Value:

Nonzero if the palette was computed; otherwise zero.

Prototype:

virtual void DeleteThis()=0;

Remarks:

This method is called to delete the Quantizer when you are done with it.

Prototype:

virtual int AllocHistogram(void)=0;

Remarks:

This method allocates the histogram used in doing the conversion.

Return Value:

Nonzero if the histogram was allocated; otherwise zero.

Prototype:

virtual void AddToHistogram(BMM_Color_64 *image, int npix)=0;

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.

Prototype:

virtual void AddToHistogram(BMM_Color_48 *image, int npix)=0;

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.

Prototype:

virtual void AddToHistogram(BMM_Color_24 *image, int npix)=0;

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.