C# Класс 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.

Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
height int
pixelSize int
stride int
width int
x int
y int

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

Метод Описание
Apply ( Bitmap sourceImage ) : Bitmap

Perform color dithering for the specified image.

Apply ( UnmanagedImage sourceImage ) : Bitmap

Perform color dithering for the specified image.

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

Метод Описание
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.

Приватные методы

Метод Описание
GetClosestColor ( int red, int green, int blue, byte &colorIndex ) : Color

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

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

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.
Результат System.Drawing.Bitmap

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

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.
Результат System.Drawing.Bitmap

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

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.
Результат void

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

Initializes a new instance of the ErrorDiffusionColorDithering class.
protected ErrorDiffusionColorDithering ( ) : System
Результат System

Описание свойств

height защищенное свойство

Processing image's height.
protected int height
Результат int

pixelSize защищенное свойство

Processing image's pixel size in bytes.
protected int pixelSize
Результат int

stride защищенное свойство

Processing image's stride (line size).
protected int stride
Результат int

width защищенное свойство

Processing image's width.
protected int width
Результат int

x защищенное свойство

Current processing X coordinate.
protected int x
Результат int

y защищенное свойство

Current processing Y coordinate.
protected int y
Результат int