Table of Contents

Class Palettes

Namespace
Egami.Quantization
Assembly
Egami.dll

Ready-made palettes.

public static class Palettes
Inheritance
Palettes
Inherited Members

Examples

// Ready-made palettes: web-safe colors, black and white, gray levels, and color cubes such as 3-3-2.
using Raster web = photo.Derive(ops => ops.Remap(Quantization.Palettes.WebSafe, DitherMode.Ordered), Ct);
using Raster bilevel = photo.Derive(ops => ops.Remap(Quantization.Palettes.BlackAndWhite, DitherMode.Riemersma), Ct);
using Raster fourGrays = photo.Derive(ops => ops.Remap(Quantization.Palettes.Grayscale(4)), Ct);
using Raster rgb332 = photo.Derive(ops => ops.Remap(Quantization.Palettes.Uniform(8, 8, 4), DitherMode.Bayer16x16), Ct);

Properties

BlackAndWhite

Gets black and white.

public static Palette BlackAndWhite { get; }

Property Value

Palette

WebSafe

Gets the 216 web-safe colors: each channel 0, 51, 102, 153, 204 or 255, red slowest.

public static Palette WebSafe { get; }

Property Value

Palette

Methods

Grayscale(int)

Returns evenly spaced grays from black to white.

public static Palette Grayscale(int levels)

Parameters

levels int

The number of grays, 2 to 256.

Returns

Palette

The palette, darkest first.

Exceptions

ArgumentOutOfRangeException

levels is outside 2 to 256.

Uniform(int, int, int)

Returns a color cube with evenly spaced levels per channel, such as 8, 8 and 4 for the classic 3-3-2 palette; red varies slowest and blue fastest.

public static Palette Uniform(int red, int green, int blue)

Parameters

red int

Levels of red, at least 2.

green int

Levels of green, at least 2.

blue int

Levels of blue, at least 2.

Returns

Palette

The palette.

Exceptions

ArgumentOutOfRangeException

A level count is less than 2, or their product is more than 256.