C# Class Accord.Imaging.ColorReduction.ErrorDiffusionColorDithering

Base class for error diffusion color dithering.

The class is the base class for color dithering algorithms based on error diffusion.

Color dithering with error diffusion is based on the idea that each pixel from the specified source image is substituted with a best matching color (or better say with color's index) from the specified color table. However, the error (difference between color value in the source image and the best matching color) is diffused to neighbor pixels of the source image, which affects the way those pixels are substituted by colors from the specified table.

The image processing routine accepts 24/32 bpp color images for processing. As a result this routine produces 4 bpp or 8 bpp indexed image, which depends on size of the specified color table - 4 bpp result for color tables with 16 colors or less; 8 bpp result for larger color tables.

Afficher le fichier Open project: accord-net/framework

Protected Properties

Свойство Type Description
height int
pixelSize int
stride int
width int
x int
y int

Méthodes publiques

Méthode Description
Apply ( Bitmap sourceImage ) : Bitmap

Perform color dithering for the specified image.

Apply ( UnmanagedImage sourceImage ) : Bitmap

Perform color dithering for the specified image.

Méthodes protégées

Méthode Description
Diffuse ( int rError, int gError, int bError, byte ptr ) : void

Do error diffusion.

All parameters of the image and current processing pixel's coordinates are initialized in protected members.

ErrorDiffusionColorDithering ( ) : System

Initializes a new instance of the ErrorDiffusionColorDithering class.

Private Methods

Méthode Description
GetClosestColor ( int red, int green, int blue, byte &colorIndex ) : Color

Method Details

Apply() public méthode

Perform color dithering for the specified image.
Unsupported pixel format of the source image. It must 24 or 32 bpp color image.
public Apply ( Bitmap sourceImage ) : Bitmap
sourceImage System.Drawing.Bitmap Source image to do color dithering for.
Résultat System.Drawing.Bitmap

Apply() public méthode

Perform color dithering for the specified image.
Unsupported pixel format of the source image. It must 24 or 32 bpp color image.
public Apply ( UnmanagedImage sourceImage ) : Bitmap
sourceImage UnmanagedImage Source image to do color dithering for.
Résultat System.Drawing.Bitmap

Diffuse() protected abstract méthode

Do error diffusion.
All parameters of the image and current processing pixel's coordinates are initialized in protected members.
protected abstract Diffuse ( int rError, int gError, int bError, byte ptr ) : void
rError int Error value of red component.
gError int Error value of green component.
bError int Error value of blue component.
ptr byte Pointer to current processing pixel.
Résultat void

ErrorDiffusionColorDithering() protected méthode

Initializes a new instance of the ErrorDiffusionColorDithering class.
protected ErrorDiffusionColorDithering ( ) : System
Résultat System

Property Details

height protected_oe property

Processing image's height.
protected int height
Résultat int

pixelSize protected_oe property

Processing image's pixel size in bytes.
protected int pixelSize
Résultat int

stride protected_oe property

Processing image's stride (line size).
protected int stride
Résultat int

width protected_oe property

Processing image's width.
protected int width
Résultat int

x protected_oe property

Current processing X coordinate.
protected int x
Résultat int

y protected_oe property

Current processing Y coordinate.
protected int y
Résultat int