ColourConversions
public static class ColourConversions
Provides static methods for converting one colour space into another. These methods have been implemented based on http://www.easyrgb.com/index.php?X=MATH and do not depend on code in Eto, Rhino, or any other assembly.
Fields
Methods
ApplyAdjective
#Apply an adjective to a colour.
Parameters:
| colour (Color) | Colour to modify. |
| adjective (ColourAdjective) | Adjective to apply. |
Returns: Modified colour.
Cmy_Rgb
#Convert RGB channels into CMY channels.
Cmy_Rgb
#Convert RGB channels into CMY channels.
Hsl_Rgb
#Convert HSL channels into Standard RGB channels.
Hsl_Rgb
#Convert HSL channels into Standard RGB channels.
Hsp_Rgb
#Convert HSP (perceived luminance) channels into RGB channels.
Hsv_Rgb
#Convert HSV/B channels into Standard RGB channels.
Lab_Xyz
#Convert Cie L*a*b* channels into Cie XYZ channels.
Lab_Xyz
#Convert Cie L*a*b* channels into Cie XYZ channels.
MapYxyPlanckianLoci
#Compute the points for key temperatures along the black body curve of the CIE Chromaticity diagram.
Parameters:
| frame (RectangleF) | Target frame for Yxy graph. |
Returns: Temperature measure array.
MapYxyPlanckianLocus
#public static PointF[] MapYxyPlanckianLocus(RectangleF frame)
Compute the points for a degree=3 bezier curve describing the black body curve of the CIE Chromaticity diagram.
Parameters:
| frame (RectangleF) | Target frame for Yxy graph. |
Returns: Point array.
MapYxyRgbGamut
#public static void MapYxyRgbGamut(RectangleF frame, out PointF red, out PointF green, out PointF blue)
Compute the cornerpoints of the sRGB gamut triangle within the CIE Chromaticity diagram.
Parameters:
| frame (RectangleF) | Target frame for Yxy graph. |
| red (out PointF) | Red corner. |
| green (out PointF) | Green corner. |
| blue (out PointF) | Blue corner. |
MapYxySpectralLoci
#Compute the points for key wavelengths along the spectral curve of the CIE Chromaticity diagram.
Parameters:
| frame (RectangleF) | Target frame for Yxy graph. |
Returns: Wavelength measure array.
MapYxySpectralLocus
#public static PointF[] MapYxySpectralLocus(RectangleF frame)
Compute the points for a degree=3 bezier curve describing the spectral curve of the CIE Chromaticity diagram.
Parameters:
| frame (RectangleF) | Target frame for Yxy graph. |
Returns: Point array.
MixColourNames
#public static Color MixColourNames(Color a, Color b)
Mix two colours using the linguistic parser logic. This method interpolates between the colours inside the Sinusoidal model.
Parameters:
| a (Color) | First colour. |
| b (Color) | Second colour. |
Returns: Midway colour.
Oklab_Oklch
#Convert Oklab channels into their polar Oklch form.
Oklch_Oklab
#Convert polar Oklch channels into Oklab channels.
Rgb_Cmy
#Convert RGB channels into CMY channels.
Rgb_Cmy
#Convert RGB channels into CMY channels.
Rgb_Hsl
#Convert Standard RGB channels into HSL channels.
Rgb_Hsl
#Convert Standard RGB channels into HSL channels.
Rgb_Hsp
#Convert RGB channels into H*SP (perceived luminance) channels.
Rgb_Hsv
#Convert Standard RGB channels into HSV/B channels.
Rgb_Hsv
#Convert Standard RGB channels into HSV/B channels.
Rgb_Hue
#Convert an RGB triplet into an HSB/HSV/HSL hue.
Rgb_Hue
#Convert an RGB triplet into an HSB/HSV/HSL hue.
Rgb_Xyz
#Convert Standard RGB channels into Cie XYZ channels.
Rgb_Xyz
#Convert Standard RGB channels into Cie XYZ channels.
ToAdjustedHue
#Convert an HSV hue into an HSP hue.
Parameters:
| hsvHue (double) | Hsv hue. |
Returns: Hsp hue.
ToTraditionalHue
#Convert an HSP hue into an HSV hue.
Parameters:
| hspHue (double) | Hsp hue. |
Returns: Hsp hue.
ToTraditionalHue
#Convert an HSP hue into an HSV hue.
Parameters:
| hspHue (float) | Hsp hue. |
Returns: Hsp hue.
TryParseNamedColour
#public static ColourParseSource TryParseNamedColour(string text, out Color colour, bool includeFuzzyParsing, bool includeMixedParsing)
Try and parse a text describing a colour by name.
Xyz_Lab
#Convert Cie XYZ channels into Cie L*a*b* channels.
Xyz_Lab
#Convert Cie XYZ channels into Cie L*a*b* channels.
Xyz_Rgb
#Convert Cie XYZ channels into Standard RGB channels. Note that the RGB values are neither clipped nor tonemapped, so they may well exceed the [0~1] range.
Xyz_Rgb
#Convert Cie XYZ channels into Standard RGB channels. Note that the RGB values are neither clipped nor tonemapped, so they may well exceed the [0~1] range.
Xyz_Yxy
#Convert Cie XYZ channels into Cie Chromaticity diagram channels.
Yxy_Xyz
#Convert Cie Chromaticity Diagram channels into Cie XYZ channels.