Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

PLFilterQuantize Class Reference

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

#include <plfilterquantize.h>

Inheritance diagram for PLFilterQuantize:

Inheritance graph
[legend]
Collaboration diagram for PLFilterQuantize:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PLFilterQuantize (int DitherPaletteType, int DitherType)
 DitherPaletteType and DitherType determine the type of quantization:.
virtual ~PLFilterQuantize ()
virtual void Apply (PLBmp *pBmpSource, PLBmp *pBmpDest) const
 Applies the Filter to pBmpSource and stores the result in pBmpDest.
void SetUserPalette (const PLPixel32 *pPal)
 For PLDTHPAL_USERDEFINED, sets the palette to use.

Static Public Member Functions

const PLPixel32GetDefaultPalette ()

Private Types

typedef PLFilterQuantize::tagQUBOX QUBOX
typedef PLFilterQuantize::tagHISTONODE HISTONODE

Private Member Functions

void initLUT ()
void deleteLUT ()
void genMedianPalette (PLBmp *pBmpSource, PLBmp *pBmpDest) const
void split (QUBOX *pBox0, QUBOX *pBox1, int ColComp) const
void squeeze (QUBOX *pBox) const
void genPopularityPalette (PLBmp *pBmpSource, PLBmp *pBmpDest) const
void genColorArray (PLBmp *pBmpSource) const
void genDefaultPalette (PLBmp *pBmpSource) const
void addColor (PLPixel32 col, PLULONG count) const
void makeBox (PLPixel32 col, int i, PLULONG c) const
int getColorTableIndex (PLPixel32 col) const
int getShiftedColorTableIndex (PLPixel32 col) const
void ditherDestBmp (PLBmp *pBmpSource, PLBmp *pBmpDest) const
void jitterPixel (int i, int y, PLPixel32 *pPixel) const
void ditherPixelOrdered (int x, int y, PLPixel32 *pPixel) const
void ditherCompOrdered (int x, int y, PLBYTE *pComp) const
void ditherPixelFS (double *pR, double *pG, double *pB, double *pCurErrors) const
void ditherCompFS (double *pComp, double Error) const
PLBYTE getNeighbor (PLPixel32 Color, PLPixel32 *pPal) const
int colorDist (PLPixel32 c0, PLPixel32 c1) const
int clip (int c) const

Private Attributes

int m_DitherPaletteType
int m_DitherType
PLPixel32m_pUserPal
HISTONODE ** m_ppHisto
QUBOXm_pQuBoxes

Detailed Description

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

Definition at line 34 of file plfilterquantize.h.


Member Typedef Documentation

typedef struct PLFilterQuantize::tagHISTONODE PLFilterQuantize::HISTONODE [private]
 

Referenced by addColor(), genPopularityPalette(), getNeighbor(), initLUT(), and squeeze().

typedef struct PLFilterQuantize::tagQUBOX PLFilterQuantize::QUBOX [private]
 

Referenced by initLUT(), split(), and squeeze().


Constructor & Destructor Documentation

PLFilterQuantize::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

Definition at line 40 of file plfilterquantize.cpp.

References initLUT(), and NULL.

Here is the call graph for this function:

PLFilterQuantize::~PLFilterQuantize  )  [virtual]
 

Definition at line 51 of file plfilterquantize.cpp.

References deleteLUT(), and m_pUserPal.

Here is the call graph for this function:


Member Function Documentation

void PLFilterQuantize::addColor PLPixel32  col,
PLULONG  count
const [private]
 

Definition at line 714 of file plfilterquantize.cpp.

References PLFilterQuantize::tagHISTONODE::count, getShiftedColorTableIndex(), HISTONODE, PLFilterQuantize::tagHISTONODE::index, m_ppHisto, min, and PLULONG.

Referenced by genColorArray(), genMedianPalette(), and genPopularityPalette().

Here is the call graph for this function:

void PLFilterQuantize::Apply PLBmp pBmpSource,
PLBmp pBmpDest
const [virtual]
 

Applies the Filter to pBmpSource and stores the result in pBmpDest.

The base-class version copies the bitmap before calling ApplyInPlace (pBmpDest).

Reimplemented from PLFilter.

Definition at line 61 of file plfilterquantize.cpp.

References PLBmp::Create(), ditherDestBmp(), genColorArray(), genDefaultPalette(), genMedianPalette(), genPopularityPalette(), PLBmp::GetBitsPerPixel(), PLBmp::GetHeight(), PLBmp::GetResolution(), PLBmp::GetWidth(), m_DitherPaletteType, m_pUserPal, PLASSERT, PLDTHPAL_DEFAULT, PLDTHPAL_MEDIAN, PLDTHPAL_POPULARITY, PLDTHPAL_USERDEFINED, and PLBmp::SetPalette().

Referenced by PLBmp::create8BPPCopy().

Here is the call graph for this function:

int PLFilterQuantize::clip int  c  )  const [inline, private]
 

Definition at line 115 of file plfilterquantize.h.

Referenced by ditherCompOrdered().

int PLFilterQuantize::colorDist PLPixel32  c0,
PLPixel32  c1
const [private]
 

Definition at line 987 of file plfilterquantize.cpp.

References PLPixel32::GetB(), PLPixel32::GetG(), and PLPixel32::GetR().

Referenced by getNeighbor().

Here is the call graph for this function:

void PLFilterQuantize::deleteLUT  )  [private]
 

Definition at line 127 of file plfilterquantize.cpp.

References COLOR_MAX, and m_ppHisto.

Referenced by ~PLFilterQuantize().

void PLFilterQuantize::ditherCompFS double *  pComp,
double  Error
const [private]
 

Definition at line 938 of file plfilterquantize.cpp.

Referenced by ditherPixelFS().

void PLFilterQuantize::ditherCompOrdered int  x,
int  y,
PLBYTE pComp
const [private]
 

Definition at line 921 of file plfilterquantize.cpp.

References clip(), and PLBYTE.

Referenced by ditherPixelOrdered().

Here is the call graph for this function:

void PLFilterQuantize::ditherDestBmp PLBmp pBmpSource,
PLBmp pBmpDest
const [private]
 

Definition at line 761 of file plfilterquantize.cpp.

References ditherPixelFS(), ditherPixelOrdered(), PLPixel32::GetB(), PLPixel32::GetG(), PLBmp::GetHeight(), PLBmp::GetLineArray(), getNeighbor(), PLBmp::GetPalette(), PLPixel32::GetR(), PLBmp::GetWidth(), m_DitherType, PLBYTE, PLDTH_FS, PLDTH_ORDERED, and PLPixel32::Set().

Referenced by Apply().

Here is the call graph for this function:

void PLFilterQuantize::ditherPixelFS double *  pR,
double *  pG,
double *  pB,
double *  pCurErrors
const [private]
 

Definition at line 931 of file plfilterquantize.cpp.

References ditherCompFS().

Referenced by ditherDestBmp().

Here is the call graph for this function:

void PLFilterQuantize::ditherPixelOrdered int  x,
int  y,
PLPixel32 pPixel
const [private]
 

Definition at line 912 of file plfilterquantize.cpp.

References ditherCompOrdered(), PL_RGBA_BLUE, PL_RGBA_GREEN, PL_RGBA_RED, and PLBYTE.

Referenced by ditherDestBmp().

Here is the call graph for this function:

void PLFilterQuantize::genColorArray PLBmp pBmpSource  )  const [private]
 

Definition at line 424 of file plfilterquantize.cpp.

References addColor(), PLBmp::GetHeight(), PLBmp::GetLineArray32(), and PLBmp::GetWidth().

Referenced by Apply().

Here is the call graph for this function:

void PLFilterQuantize::genDefaultPalette PLBmp pBmpSource  )  const [private]
 

Definition at line 707 of file plfilterquantize.cpp.

References DefaultPalette, and PLBmp::GetPalette().

Referenced by Apply().

Here is the call graph for this function:

void PLFilterQuantize::genMedianPalette PLBmp pBmpSource,
PLBmp pBmpDest
const [private]
 

Definition at line 143 of file plfilterquantize.cpp.

References addColor(), PLFilterQuantize::tagQUBOX::Average, PLFilterQuantize::tagQUBOX::Corner0, PLFilterQuantize::tagQUBOX::Corner1, PLFilterQuantize::tagQUBOX::count, PLPixel32::GetB(), PLPixel32::GetG(), PLBmp::GetPalette(), PLPixel32::GetR(), m_pQuBoxes, makeBox(), PLBYTE, PLPixel32::Set(), split(), and squeeze().

Referenced by Apply().

Here is the call graph for this function:

void PLFilterQuantize::genPopularityPalette PLBmp pBmpSource,
PLBmp pBmpDest
const [private]
 

Definition at line 349 of file plfilterquantize.cpp.

References addColor(), PLFilterQuantize::tagHISTONODE::count, getColorTableIndex(), PLBmp::GetPalette(), HISTONODE, m_ppHisto, PLULONG, PLPixel32::Set(), PLPixel32::SetB(), PLPixel32::SetG(), PLPixel32::SetR(), and SwapLong().

Referenced by Apply().

Here is the call graph for this function:

int PLFilterQuantize::getColorTableIndex PLPixel32  col  )  const [private]
 

Definition at line 745 of file plfilterquantize.cpp.

References PLPixel32::GetB(), PLPixel32::GetG(), and PLPixel32::GetR().

Referenced by genPopularityPalette(), and squeeze().

Here is the call graph for this function:

const PLPixel32 * PLFilterQuantize::GetDefaultPalette  )  [static]
 

Definition at line 702 of file plfilterquantize.cpp.

PLBYTE PLFilterQuantize::getNeighbor PLPixel32  Color,
PLPixel32 pPal
const [private]
 

Definition at line 947 of file plfilterquantize.cpp.

References colorDist(), PLFilterQuantize::tagHISTONODE::count, getShiftedColorTableIndex(), HISTONODE, PLFilterQuantize::tagHISTONODE::index, m_ppHisto, and PLBYTE.

Referenced by ditherDestBmp().

Here is the call graph for this function:

int PLFilterQuantize::getShiftedColorTableIndex PLPixel32  col  )  const [private]
 

Definition at line 753 of file plfilterquantize.cpp.

References PLPixel32::GetB(), PLPixel32::GetG(), and PLPixel32::GetR().

Referenced by addColor(), and getNeighbor().

Here is the call graph for this function:

void PLFilterQuantize::initLUT  )  [private]
 

Definition at line 111 of file plfilterquantize.cpp.

References COLOR_MAX, HISTONODE, m_ppHisto, m_pQuBoxes, PL_ERRNO_MEMORY, PLULONG, and QUBOX.

Referenced by PLFilterQuantize().

void PLFilterQuantize::jitterPixel int  i,
int  y,
PLPixel32 pPixel
const [private]
 

Definition at line 908 of file plfilterquantize.cpp.

void PLFilterQuantize::makeBox PLPixel32  col,
int  i,
PLULONG  c
const [private]
 

Definition at line 738 of file plfilterquantize.cpp.

References PLFilterQuantize::tagQUBOX::Corner0, PLFilterQuantize::tagQUBOX::Corner1, PLFilterQuantize::tagQUBOX::count, m_pQuBoxes, and PLULONG.

Referenced by genMedianPalette().

void PLFilterQuantize::SetUserPalette const PLPixel32 pPal  ) 
 

For PLDTHPAL_USERDEFINED, sets the palette to use.

Definition at line 102 of file plfilterquantize.cpp.

References m_pUserPal.

void PLFilterQuantize::split QUBOX pBox0,
QUBOX pBox1,
int  ColComp
const [private]
 

Definition at line 244 of file plfilterquantize.cpp.

References PLFilterQuantize::tagQUBOX::Average, PLFilterQuantize::tagQUBOX::Corner0, PLFilterQuantize::tagQUBOX::Corner1, PLASSERT, PLBYTE, QUBOX, and squeeze().

Referenced by genMedianPalette().

Here is the call graph for this function:

void PLFilterQuantize::squeeze QUBOX pBox  )  const [private]
 

Definition at line 280 of file plfilterquantize.cpp.

References PLFilterQuantize::tagQUBOX::Average, PLFilterQuantize::tagQUBOX::Corner0, PLFilterQuantize::tagQUBOX::Corner1, PLFilterQuantize::tagQUBOX::count, PLFilterQuantize::tagHISTONODE::count, PLPixel32::GetB(), getColorTableIndex(), PLPixel32::GetG(), PLPixel32::GetR(), HISTONODE, m_ppHisto, max, min, PLBYTE, PLULONG, and QUBOX.

Referenced by genMedianPalette(), and split().

Here is the call graph for this function:


Member Data Documentation

int PLFilterQuantize::m_DitherPaletteType [private]
 

Definition at line 106 of file plfilterquantize.h.

Referenced by Apply().

int PLFilterQuantize::m_DitherType [private]
 

Definition at line 107 of file plfilterquantize.h.

Referenced by ditherDestBmp().

HISTONODE** PLFilterQuantize::m_ppHisto [private]
 

Definition at line 110 of file plfilterquantize.h.

Referenced by addColor(), deleteLUT(), genPopularityPalette(), getNeighbor(), initLUT(), and squeeze().

QUBOX* PLFilterQuantize::m_pQuBoxes [private]
 

Definition at line 112 of file plfilterquantize.h.

Referenced by genMedianPalette(), initLUT(), and makeBox().

PLPixel32* PLFilterQuantize::m_pUserPal [private]
 

Definition at line 108 of file plfilterquantize.h.

Referenced by Apply(), SetUserPalette(), and ~PLFilterQuantize().


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 21:21:00 2004 for vuVolume by  doxygen 1.3.9.1