ColorPalette Class

Represents a palette, i.e. an array of color values.

Namespace: Aurigma.GraphicsMill
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

C#
public sealed class ColorPalette : IEnumerable<RgbColor>, IDisposable

Remarks

Color palettes are used in indexed bitmaps to store colors. Each pixel of the indexed bitmap is an index you should pass to Item[ Int32] to get an actual color this pixel represents. These indices should not exceed total number of palette entries which you can get through Count property.

Since the palettes never store more than 256 entries, only few of 16 millions 24-bit RGB colors are available in the palette. That's why if you need change a color of some pixel, you cannot pass arbitrary color. You should find nearest color in the palette and pass its index instead. To convert the color into index in this palette, you can use FindNearestIndex(RgbColor) method. Note, this method works quite slow, that's why you should cache nearest index if possible.

Inheritance Hierarchy

System..Object
L Aurigma.GraphicsMill..ColorPalette

Thread Safety

Static members of this type are not safe for multi-threaded operations. Instance members of this type are not safe for multi-threaded operations.

See Also

Reference

Manual