Table of Contents

Class ColorPrimaries

Namespace
Egami.Colors
Assembly
Egami.dll

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

Red Chromaticity

The red primary.

Green Chromaticity

The green primary.

Blue Chromaticity

The blue primary.

White Chromaticity

The 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

ColorPrimaries

Blue

The blue primary.

public Chromaticity Blue { get; init; }

Property Value

Chromaticity

DisplayP3

Gets the Display P3 primaries (SMPTE EG 432-1) with D65 white.

public static ColorPrimaries DisplayP3 { get; }

Property Value

ColorPrimaries

Green

The green primary.

public Chromaticity Green { get; init; }

Property Value

Chromaticity

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

bool

ProPhoto

Gets the ProPhoto RGB (ROMM RGB) primaries with D50 white.

public static ColorPrimaries ProPhoto { get; }

Property Value

ColorPrimaries

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

ColorPrimaries

Rec709

Gets the ITU-R BT.709 primaries with D65 white, which sRGB uses.

public static ColorPrimaries Rec709 { get; }

Property Value

ColorPrimaries

Red

The red primary.

public Chromaticity Red { get; init; }

Property Value

Chromaticity

White

The white point.

public Chromaticity White { get; init; }

Property Value

Chromaticity

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

other ColorPrimaries

The other primaries.

tolerance double

The largest difference allowed in any coordinate.

Returns

bool

true if every coordinate matches.