Class ColorPrimaries
The chromaticities of an RGB color space's red, green and blue primaries and of its white. With a transfer function they make a ColorProfile.
public sealed record ColorPrimaries : IEquatable<ColorPrimaries>
- Inheritance
-
ColorPrimaries
- Implements
- Inherited Members
Examples
// Primaries are the chromaticities of red, green, blue and white.
ColorPrimaries p3 = ColorPrimaries.DisplayP3;
Chromaticity red = p3.Red;
Console.WriteLine($"P3 red is x {red.X}, y {red.Y}; white is D65: {p3.White == Chromaticity.D65}");
ColorPrimaries custom = new(new(0.68, 0.32), new(0.265, 0.69), new(0.15, 0.06), Chromaticity.D65);
Constructors
ColorPrimaries(Chromaticity, Chromaticity, Chromaticity, Chromaticity)
The chromaticities of an RGB color space's red, green and blue primaries and of its white. With a transfer function they make a ColorProfile.
public ColorPrimaries(Chromaticity Red, Chromaticity Green, Chromaticity Blue, Chromaticity White)
Parameters
RedChromaticityThe red primary.
GreenChromaticityThe green primary.
BlueChromaticityThe blue primary.
WhiteChromaticityThe white point.
Examples
// Primaries are the chromaticities of red, green, blue and white.
ColorPrimaries p3 = ColorPrimaries.DisplayP3;
Chromaticity red = p3.Red;
Console.WriteLine($"P3 red is x {red.X}, y {red.Y}; white is D65: {p3.White == Chromaticity.D65}");
ColorPrimaries custom = new(new(0.68, 0.32), new(0.265, 0.69), new(0.15, 0.06), Chromaticity.D65);
Properties
AdobeRgb
Gets the Adobe RGB (1998) primaries with D65 white.
public static ColorPrimaries AdobeRgb { get; }
Property Value
Blue
The blue primary.
public Chromaticity Blue { get; init; }
Property Value
DisplayP3
Gets the Display P3 primaries (SMPTE EG 432-1) with D65 white.
public static ColorPrimaries DisplayP3 { get; }
Property Value
Green
The green primary.
public Chromaticity Green { get; init; }
Property Value
IsValid
Gets a value indicating whether the primaries can form a color space: every point valid and the triangle not flat.
public bool IsValid { get; }
Property Value
ProPhoto
Gets the ProPhoto RGB (ROMM RGB) primaries with D50 white.
public static ColorPrimaries ProPhoto { get; }
Property Value
Rec2020
Gets the ITU-R BT.2020 primaries with D65 white, used by Rec. 2020 and Rec. 2100.
public static ColorPrimaries Rec2020 { get; }
Property Value
Rec709
Gets the ITU-R BT.709 primaries with D65 white, which sRGB uses.
public static ColorPrimaries Rec709 { get; }
Property Value
Red
The red primary.
public Chromaticity Red { get; init; }
Property Value
White
The white point.
public Chromaticity White { get; init; }
Property Value
Methods
IsCloseTo(ColorPrimaries, double)
Returns whether two sets of primaries are the same within tolerance in x and y.
public bool IsCloseTo(ColorPrimaries other, double tolerance = 0.0001)
Parameters
otherColorPrimariesThe other primaries.
tolerancedoubleThe largest difference allowed in any coordinate.