YxyDiagramGeometry

public sealed class YxyDiagramGeometry
All the vector geometry part of a chromaticity diagram cached for a specific frame. Try re-using instances of this class if possible to avoid unnecessary overhead.

Constructors

YxyDiagramGeometry

#
public YxyDiagramGeometry(RectangleF frame)
Create a new diagram.
frame (RectangleF)Frame.

Properties

Frame

#
public RectangleF Frame { get; }
Gets the frame this geometry is cached for.

GamutBlue

#
public PointF GamutBlue { get; }
Gets the blue corner of the sRGB gamut triangle.

GamutGreen

#
public PointF GamutGreen { get; }
Gets the green corner of the sRGB gamut triangle.

GamutRed

#
public PointF GamutRed { get; }
Gets the red corner of the sRGB gamut triangle.

Grid

#
public RectangleF Grid { get; }
Gets the grid rectangle. It takes up 80% of the frame width and 90% of the frame height.

PlanckInfinity

#
public PointF PlanckInfinity { get; }
Gets the end point of the Planckian locus.

PlanckThousand

#
public PointF PlanckThousand { get; }
Gets the start point of the Planckian locus.

YxyUnit

#
public RectangleF YxyUnit { get; }
Gets the texture rectangle unit target rectangle. It exceeds the frame, but is used only to position Yxy vectorial unitised geometry within the grid.

Methods

DrawDiagramFill

#
public void DrawDiagramFill(Context context, Bitmap texture)
Draw the Yxy diagram texture.
context (Context)Graphics context.
texture (Bitmap)Yxy texture. You should generate this using a YxyDiagramCache instance.

DrawGamutBoundary

#
public void DrawGamutBoundary(Context context, Pen edge, Color labelColour, Font font)
Draw the sRGB gamut boundary.
context (Context)Graphics context.
edge (Pen)Pen to use for gamut boundary.
labelColour (Color)Colour of gamut label.
font (Font)Font of gamut label.

DrawGamutExcession

#
public void DrawGamutExcession(Context context, float strength = 0.1)
Draw the region outside the sRGB gamut.
context (Context)Graphics context.
strength (float = 0.1)Hatching darkness, the default is 0.1.

DrawGrid

#
public void DrawGrid(Context context, Pen border, Pen line)
Draw the Yxy grid lines.
context (Context)Context to draw with.
border (Pen)Pen for grid border.
line (Pen)Pen for grid lines.

DrawGrid

#
public void DrawGrid(Context context, Pen border, Pen majorLine, Pen minorLine)
Draw the Yxy grid lines.
context (Context)Context to draw with.
border (Pen)Pen for grid border.
majorLine (Pen)Pen for 0.1 grid lines.
minorLine (Pen)Pen for 0.05 grid lines.

DrawGridLabels

#
public void DrawGridLabels(Context context, Font font, Color colour)
Draw the grid labels. Note that the labels exceed the Frame rectangle and are typically not included.
context (Context)Graphics context.
font (Font)Font to use.
colour (Color)Colour of labels.

DrawPlanckianLocus

#
public void DrawPlanckianLocus(Context context, Font font, float width, Color colour1000, Color colourInfinite)
Draw the Planckian locus.
context (Context)Graphics context.
font (Font)Font to use for iso-planckian labels, may be null.
width (float)Width of locus lines.
colour1000 (Color)Colour at 1000K.
colourInfinite (Color)Colour at infinite temperature.

DrawPurpleShadow

#
public void DrawPurpleShadow(Context context, float darkness = 0.08)
Draw a drop shadow along the line of purples.
context (Context)Graphics context.
darkness (float = 0.08)Darkness of shadow. The default is 0.08.

DrawSpectralLoci

#
public void DrawSpectralLoci(Context context, Font font, Color colour)
Draw the spectral loci at ~5nm intervals.
context (Context)Graphics context.
font (Font)Font to use.
colour (Color)Colour to use.

DrawSpectralLocus

#
public void DrawSpectralLocus(Context context, float width, Color colour)
Draw the spectral locus and the line of purples.
context (Context)Graphics context.
width (float)Width of boundary curve.
colour (Color)Colour of edges.

LimitChromaticityToGrid

#
public static bool LimitChromaticityToGrid(float x, float y, out float xm, out float ym)
Limit a chromaticity coordinate to the interior of the grid, thus avoiding colours exceeding the chromaticity diagram.
x (float)Original x coordinate.
y (float)Original y coordinate.
xm (out float)Projected x coordinate.
ym (out float)Projected y coordinate.
True if coordinate had to be projected.

LimitChromaticityToSpectrum

#
public static bool LimitChromaticityToSpectrum(float x, float y, out float xm, out float ym)
Limit a chromaticity coordinate to the interior of the spectrum, thus avoiding a imaginary colours.
x (float)Original x coordinate.
y (float)Original y coordinate.
xm (out float)Projected x coordinate.
ym (out float)Projected y coordinate.
True if coordinate had to be projected.