Quantizer Class Reference

#include <palutil.h>

Class 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.
+ Inheritance diagram for Quantizer:

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
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Constructor & Destructor Documentation

virtual ~Quantizer ( )
inlinevirtual
Remarks
Destructor.
121 {}

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.