C# Класс PurplePen.Quantizer

Base class for quantizer.
Показать файл Открыть проект

Открытые методы

Метод Описание
Quantize ( Bitmap source ) : Bitmap

Quantize an image and return the resulting output bitmap

Quantizer ( bool singlePass ) : System

Construct the quantizer

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'.

Защищенные методы

Метод Описание
FirstPass ( BitmapData sourceData, int width, int height ) : void

Execute the first pass through the pixels in the image

GetPalette ( System.Drawing.Imaging.ColorPalette original ) : System.Drawing.Imaging.ColorPalette

Retrieve the palette for the quantized image

InitialQuantizePixel ( Color32 pixel ) : void

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

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

QuantizePixel ( Color32 pixel ) : byte

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

SecondPass ( BitmapData sourceData, Bitmap output, int width, int height, Rectangle bounds ) : void

Execute a second pass through the bitmap

Описание методов

FirstPass() защищенный Метод

Execute the first pass through the pixels in the image
protected FirstPass ( BitmapData sourceData, int width, int height ) : void
sourceData System.Drawing.Imaging.BitmapData The source data
width int The width in pixels of the image
height int The height in pixels of the image
Результат void

GetPalette() защищенный абстрактный Метод

Retrieve the palette for the quantized image
protected abstract GetPalette ( System.Drawing.Imaging.ColorPalette original ) : System.Drawing.Imaging.ColorPalette
original System.Drawing.Imaging.ColorPalette Any old palette, this is overrwritten
Результат System.Drawing.Imaging.ColorPalette

InitialQuantizePixel() защищенный Метод

Override this to process the pixel in the first pass of the algorithm
This function need only be overridden if your quantize algorithm needs two passes, such as an Octree quantizer.
protected InitialQuantizePixel ( Color32 pixel ) : void
pixel Color32 The pixel to quantize
Результат void

Quantize() публичный Метод

Quantize an image and return the resulting output bitmap
public Quantize ( Bitmap source ) : Bitmap
source System.Drawing.Bitmap The image to quantize
Результат System.Drawing.Bitmap

QuantizePixel() защищенный абстрактный Метод

Override this to process the pixel in the second pass of the algorithm
protected abstract QuantizePixel ( Color32 pixel ) : byte
pixel Color32 The pixel to quantize
Результат byte

Quantizer() публичный Метод

Construct the quantizer
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'.
public Quantizer ( bool singlePass ) : System
singlePass bool If true, the quantization only needs to loop through the source pixels once
Результат System

SecondPass() защищенный Метод

Execute a second pass through the bitmap
protected SecondPass ( BitmapData sourceData, Bitmap output, int width, int height, Rectangle bounds ) : void
sourceData System.Drawing.Imaging.BitmapData The source bitmap, locked into memory
output System.Drawing.Bitmap The output bitmap
width int The width in pixels of the image
height int The height in pixels of the image
bounds System.Drawing.Rectangle The bounding rectangle
Результат void