ImageResizer
3.4.0
|
Quantize using an Octree More...
Public Member Functions | |
OctreeQuantizer (int maxColors, int maxColorBits) | |
Construct the octree quantizer More... | |
override void | Reset () |
Clears the octree More... | |
void | Reset (int maxColors, int maxColorBits) |
Clears the octree and reconfigures color settings More... | |
Public Member Functions inherited from ImageResizer.Plugins.PrettyGifs.Quantizer | |
Quantizer (bool fixedPalette) | |
Construct the quantizer More... | |
Bitmap | Quantize (Image src) |
Quantize an image and return the resulting output bitmap More... | |
Public Attributes | |
float[,] | DitherMatrix |
a Floyd-Steinberg dither matrix new float[,] {{0,0,0}, {0,0,0.44f}, {0.19f,0.31f,0.06f}}; More... | |
float | DitherPercent = .3f |
Protected Member Functions | |
override void | InitialQuantizePixel (Color32 pixel) |
Process the pixel in the first pass of the algorithm More... | |
override byte | QuantizePixel (Color32 pixel) |
Override this to process the pixel in the second pass of the algorithm More... | |
override ColorPalette | GetPalette (ColorPalette original) |
Retrieve the palette for the quantized image More... | |
Protected Member Functions inherited from ImageResizer.Plugins.PrettyGifs.Quantizer | |
virtual void | ValidatePropertyValues () |
Bitmap | QuantizeFullTrust (Bitmap firstPass, Bitmap copy, Bitmap copy2, Bitmap output) |
Bitmap | QuantizeLowTrust (Bitmap firstPass, Bitmap copy, Bitmap copy2, Bitmap output) |
virtual void | AnalyzeImage (BitmapData sourceData, int width, int height) |
Execute the first pass through the pixels in the image More... | |
virtual void | AnalyzeImageLowTrust (Bitmap b, int width, int height) |
virtual void | QuantizeImage (BitmapData sourceData, BitmapData intermediate, Bitmap output, int width, int height, Rectangle bounds) |
Execute a second pass through the bitmap. If dithering is enabled, sourceData will be modified. More... | |
void | AdjustNeighborSource (int offsetX, int offsetY, int deltaR, int deltaG, int deltaB, int deltaA) |
Can only be called from QuantizePixel... This is how dithering is done... 5-18-09 ndj More... | |
byte | ToByte (int i) |
Protected Attributes | |
bool | _dither = false |
Properties | |
bool | Dither [get, set] |
Uses a Floyd-Steinberg dither More... | |
Properties inherited from ImageResizer.Plugins.PrettyGifs.Quantizer | |
bool | FixedPalette [get] |
(Readonly) If true, the algorithm can do everything in QuantizePixel, and InitialQuantizePixel will not be called. Implies ResizeForFirstPass=False and FourPass=false= More... | |
int | PixelSize [get] |
The number of bytes in a ARGB structure. Should be 4 More... | |
bool | FullTrust [get, set] |
If true, pointer arithmetic will be used instead of GetPixel. GetPixel is much slower. If false, OmitFinalStage will be assumed true, as only palette generation is possible in low trust. Defaults to true. More... | |
bool | ResizeForFirstPass [get, set] |
If true, the first pass (InitialQuantizePixel) will be performed on a size-limited version of the original image to control performance. Ignored if FixedPalette=True More... | |
long | FirstPassPixelCount [get, set] |
The approximate number of pixels to use when making a scaled copy of the image for the first pass. Only used when ResizeForFirstPass=True and FirstPassPixelThreshold is exceeded. More... | |
long | FirstPassPixelThreshold [get, set] |
The maximum number of pixels the original image may contain before a scaled copy is made for the first pass. Only relevant when ResizeForFirstPass=True More... | |
bool | FourPass [get, set] |
If true, image is re-paletted after quantization - forces 2 clones of the original image to be created. FixedPalette and OmitFinalStage should be false if this is used. More... | |
bool | OmitFinalStage [get, set] |
If true, a 32-bit image with an 8-bit palette will be returned instead of an 8-bit image, which GDI can save using median-cut quantization. Much faster than our final quantization pass, although it can't do transparency. Assumed true if FullTrust is false. More... | |
Quantize using an Octree
Definition at line 27 of file OctreeQuantizer.cs.
|
inline |
Construct the octree quantizer
The Octree quantizer is a two pass algorithm. The initial pass sets up the octree, the second pass quantizes a color based on the nodes in the tree
maxColors | The maximum number of colors to return |
maxColorBits | The number of significant bits |
Definition at line 38 of file OctreeQuantizer.cs.
|
inlineprotectedvirtual |
Retrieve the palette for the quantized image
original | Any old palette, this is overrwritten |
Implements ImageResizer.Plugins.PrettyGifs.Quantizer.
Definition at line 175 of file OctreeQuantizer.cs.
|
inlineprotectedvirtual |
Process the pixel in the first pass of the algorithm
pixel | The pixel to quantize |
This function need only be overridden if your quantize algorithm needs two passes, such as an Octree quantizer.
Reimplemented from ImageResizer.Plugins.PrettyGifs.Quantizer.
Definition at line 79 of file OctreeQuantizer.cs.
|
inlineprotectedvirtual |
Override this to process the pixel in the second pass of the algorithm
pixel | The pixel to quantize |
Implements ImageResizer.Plugins.PrettyGifs.Quantizer.
Definition at line 112 of file OctreeQuantizer.cs.
|
inlinevirtual |
Clears the octree
Reimplemented from ImageResizer.Plugins.PrettyGifs.Quantizer.
Definition at line 45 of file OctreeQuantizer.cs.
|
inline |
Clears the octree and reconfigures color settings
maxColors | |
maxColorBits |
Definition at line 56 of file OctreeQuantizer.cs.
float [,] ImageResizer.Plugins.PrettyGifs.OctreeQuantizer.DitherMatrix |
a Floyd-Steinberg dither matrix new float[,] {{0,0,0}, {0,0,0.44f}, {0.19f,0.31f,0.06f}};
Definition at line 102 of file OctreeQuantizer.cs.
|
getset |
Uses a Floyd-Steinberg dither
Definition at line 92 of file OctreeQuantizer.cs.