Table of Contents

Class ColorQuantizer

Namespace
Artemis.Core.ColorScience
Assembly
Artemis.Core.dll

Helper class for color quantization.

public static class ColorQuantizer
Inheritance
object
ColorQuantizer

Methods

FindAllColorVariations(IEnumerable<SKColor>, bool)

Finds all the color variations available and returns a struct containing them all.

public static ColorSwatch FindAllColorVariations(IEnumerable<SKColor> colors, bool ignoreLimits = false)

Parameters

colors IEnumerable<SKColor>

The colors to find the variations in

ignoreLimits bool

Ignore hard limits on whether a color is considered for each category. Some colors may be Empty if this is false

Returns

ColorSwatch

A swatch containing all color variations

FindColorVariation(IEnumerable<SKColor>, ColorType, bool)

Finds colors with certain characteristics in a given IEnumerable<T>.

Vibrant variants are more saturated, while Muted colors are less.

Light and Dark colors have higher and lower lightness values, respectively.
public static SKColor FindColorVariation(IEnumerable<SKColor> colors, ColorType type, bool ignoreLimits = false)

Parameters

colors IEnumerable<SKColor>

The colors to find the variations in

type ColorType

Which type of color to find

ignoreLimits bool

Ignore hard limits on whether a color is considered for each category. Result may be Empty if this is false

Returns

SKColor

The color found

GetGradientFromImage(SKBitmap)

Gets a gradient from a given image.

public static ColorGradient GetGradientFromImage(SKBitmap bitmap)

Parameters

bitmap SKBitmap

The image to process

Returns

ColorGradient

Quantize(Span<SKColor>, int)

Quantizes a span of colors into the desired amount of representative colors.

public static SKColor[] Quantize(Span<SKColor> colors, int amount)

Parameters

colors Span<SKColor>

The colors to quantize

amount int

How many colors to return. Must be a power of two.

Returns

SKColor[]

amount colors.

Quantize(in Span<SKColor>, int)

Quantizes a span of colors into the desired amount of representative colors.

[Obsolete("Use Quantize(Span<SKColor> colors, int amount) in-parameter instead")]
public static SKColor[] Quantize(in Span<SKColor> colors, int amount)

Parameters

colors Span<SKColor>

The colors to quantize

amount int

How many colors to return. Must be a power of two.

Returns

SKColor[]

amount colors.

QuantizeSplit(Span<SKColor>, int)

Quantizes a span of colors, splitting the average splits number of times.

public static SKColor[] QuantizeSplit(Span<SKColor> colors, int splits)

Parameters

colors Span<SKColor>

The colors to quantize

splits int

How many splits to execute. Each split doubles the number of colors returned.

Returns

SKColor[]

Up to (2 ^ splits) number of colors.

QuantizeSplit(in Span<SKColor>, int)

Quantizes a span of colors, splitting the average splits number of times.

[Obsolete("Use QuantizeSplit(Span<SKColor> colors, int splits) without the in-parameter instead")]
public static SKColor[] QuantizeSplit(in Span<SKColor> colors, int splits)

Parameters

colors Span<SKColor>

The colors to quantize

splits int

How many splits to execute. Each split doubles the number of colors returned.

Returns

SKColor[]

Up to (2 ^ splits) number of colors.