Class ColorQuantizer
- Namespace
- Artemis.Core.ColorScience
- Assembly
- Artemis.Core.dll
Helper class for color quantization.
public static class ColorQuantizer
- Inheritance
-
objectColorQuantizer
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
colorsIEnumerable<SKColor>The colors to find the variations in
ignoreLimitsboolIgnore 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
colorsIEnumerable<SKColor>The colors to find the variations in
typeColorTypeWhich type of color to find
ignoreLimitsboolIgnore 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
bitmapSKBitmapThe image to process
Returns
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
colorsSpan<SKColor>The colors to quantize
amountintHow many colors to return. Must be a power of two.
Returns
- SKColor[]
amountcolors.
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
colorsSpan<SKColor>The colors to quantize
amountintHow many colors to return. Must be a power of two.
Returns
- SKColor[]
amountcolors.
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
colorsSpan<SKColor>The colors to quantize
splitsintHow 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
colorsSpan<SKColor>The colors to quantize
splitsintHow many splits to execute. Each split doubles the number of colors returned.
Returns
- SKColor[]
Up to (2 ^
splits) number of colors.