• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class Quantizer

Abstarct class for Quantizers.

Inheritance
System.Object
Quantizer
OctreeQuantizer
PaletteQuantizer
Namespace: DotNetNuke.Services.GeneratedImage.ImageQuantization
Assembly: DotNetNuke.dll
Syntax
public abstract class Quantizer : object

Constructors

| Improve this Doc View Source

Quantizer(Boolean)

Initializes a new instance of the Quantizer class. Construct the quantizer.

Declaration
public Quantizer(bool singlePass)
Parameters
Type Name Description
System.Boolean singlePass

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

Remarks

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

Methods

| Improve this Doc View Source

FirstPass(BitmapData, Int32, Int32)

Execute the first pass through the pixels in the image.

Declaration
protected virtual void FirstPass(BitmapData sourceData, int width, int height)
Parameters
Type Name Description
BitmapData sourceData

The source data.

System.Int32 width

The width in pixels of the image.

System.Int32 height

The height in pixels of the image.

| Improve this Doc View Source

GetPalette(ColorPalette)

Retrieve the palette for the quantized image.

Declaration
protected abstract ColorPalette GetPalette(ColorPalette original)
Parameters
Type Name Description
ColorPalette original

Any old palette, this is overrwritten.

Returns
Type Description
ColorPalette

The new color palette.

| Improve this Doc View Source

InitialQuantizePixel(Quantizer.Color32)

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

Declaration
protected virtual void InitialQuantizePixel(Quantizer.Color32 pixel)
Parameters
Type Name Description
Quantizer.Color32 pixel

The pixel to quantize.

Remarks

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

| Improve this Doc View Source

Quantize(Image)

Quantize an image and return the resulting output bitmap.

Declaration
public Bitmap Quantize(Image source)
Parameters
Type Name Description
Image source

The image to quantize.

Returns
Type Description
Bitmap

A quantized version of the image.

| Improve this Doc View Source

QuantizePixel(Quantizer.Color32)

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

Declaration
protected abstract byte QuantizePixel(Quantizer.Color32 pixel)
Parameters
Type Name Description
Quantizer.Color32 pixel

The pixel to quantize.

Returns
Type Description
System.Byte

The quantized value.

| Improve this Doc View Source

SecondPass(BitmapData, Bitmap, Int32, Int32, Rectangle)

Execute a second pass through the bitmap.

Declaration
protected virtual void SecondPass(BitmapData sourceData, Bitmap output, int width, int height, Rectangle bounds)
Parameters
Type Name Description
BitmapData sourceData

The source bitmap, locked into memory.

Bitmap output

The output bitmap.

System.Int32 width

The width in pixels of the image.

System.Int32 height

The height in pixels of the image.

Rectangle bounds

The bounding rectangle.

Extension Methods

JsonExtensionsWeb.ToJson(Object)
  • View Source
Back to top by the community, for the community... #DNNCMS