fCraft  0.636
Custom Minecraft Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events
Classes | Public Member Functions | Protected Member Functions | List of all members
ImageManipulation.Quantizer Class Referenceabstract
Inheritance diagram for ImageManipulation.Quantizer:
Inheritance graph
[legend]

Classes

struct  Color32
 Struct that defines a 32 bpp colour. More...
 

Public Member Functions

Bitmap Quantize (Image source)
 Quantize an image and return the resulting output bitmap.
 

Protected Member Functions

 Quantizer (bool singlePass)
 Construct the quantizer.
 
void FirstPass (BitmapData sourceData, int width, int height)
 Execute the first pass through the pixels in the image.
 
void SecondPass (BitmapData sourceData, Bitmap output, int width, int height, Rectangle bounds)
 Execute a second pass through the bitmap.
 
virtual void InitialQuantizePixel (Color32 *pixel)
 Override this to process the pixel in the first pass of the algorithm.
 
abstract byte QuantizePixel (Color32 *pixel)
 Override this to process the pixel in the second pass of the algorithm.
 
abstract ColorPalette GetPalette (ColorPalette original)
 Retrieve the palette for the quantized image.
 

Constructor & Destructor Documentation

ImageManipulation.Quantizer.Quantizer ( bool  singlePass)
protected

Construct the quantizer.

Parameters
singlePassIf true, the quantization only needs to loop through the source pixels once.

If you construct this class with a true value for singlePass, then the code will, when quantizing your image, only call the 'QuantizeImage' function. If two passes are required, the code will call 'InitialQuantizeImage' and then 'QuantizeImage'.

Member Function Documentation

void ImageManipulation.Quantizer.FirstPass ( BitmapData  sourceData,
int  width,
int  height 
)
protected

Execute the first pass through the pixels in the image.

Parameters
sourceDataThe source data.
widthThe width in pixels of the image.
heightThe height in pixels of the image.
abstract ColorPalette ImageManipulation.Quantizer.GetPalette ( ColorPalette  original)
protectedpure virtual

Retrieve the palette for the quantized image.

Parameters
originalAny old palette, this is overrwritten.
Returns
The new color palette.

Implemented in ImageManipulation.OctreeQuantizer.

virtual void ImageManipulation.Quantizer.InitialQuantizePixel ( Color32 pixel)
protectedvirtual

Override this to process the pixel in the first pass of the algorithm.

Parameters
pixelThe pixel to quantize.

This function need only be overridden if your quantize algorithm needs two passes, such as an Octree quantizer.

Reimplemented in ImageManipulation.OctreeQuantizer.

Bitmap ImageManipulation.Quantizer.Quantize ( Image  source)

Quantize an image and return the resulting output bitmap.

Parameters
sourceThe image to quantize.
Returns
A quantized version of the image.
abstract byte ImageManipulation.Quantizer.QuantizePixel ( Color32 pixel)
protectedpure virtual

Override this to process the pixel in the second pass of the algorithm.

Parameters
pixelThe pixel to quantize.
Returns
The quantized value.

Implemented in ImageManipulation.OctreeQuantizer.

void ImageManipulation.Quantizer.SecondPass ( BitmapData  sourceData,
Bitmap  output,
int  width,
int  height,
Rectangle  bounds 
)
protected

Execute a second pass through the bitmap.

Parameters
sourceDataThe source bitmap, locked into memory.
outputThe output bitmap.
widthThe width in pixels of the image.
heightThe height in pixels of the image.
boundsThe bounding rectangle.

The documentation for this class was generated from the following file: