Table of Contents

Namespace Egami.Colors

Classes

ColorConvert

Converts between color values (IColorValue<TSelf>), through XYZ D65, and between rows of pixels and color values.

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.

ColorProfile

What a raster's numbers mean: the color model, the primaries and white point, and the transfer function. Immutable; the built-ins cover the common encodings, and Create(ColorPrimaries, TransferFunction, string?) makes any other RGB encoding.

ColorTransform

A conversion from one color encoding to another, compiled once and then applied to spans of pixels of any type. Reusable and safe to share between threads. Transforms are cached per EgamiContext, so creating the same one again is cheap.

ColorTransformOptions

How a color conversion maps colors: the rendering intent, black point compensation, and for HDR sources, tone mapping, the source peak and reference white.

Colorant

A named ink: a process ink, a spot colour or a technical ink, with how it looks for backends that cannot print it. Names are matched exactly (ordinal, case-sensitive), as PDF matches them; the names Cyan, Magenta, Yellow and Black always mean the process inks, as in PDF's DeviceN. Two colorants are equal when their names are.

GainMap

An HDR gain map: a small image that, with GainMapInfo, turns an SDR base image into its HDR rendition (or the reverse). Read from Ultra HDR, ISO 21496-1 and Apple JPEG files into GainMap; written back by the JPEG writer. Immutable, so rasters can share it.

GainMapInfo

How a gain map turns its base image into another rendition, in ISO 21496-1's terms: for a gain map sample g (0 to 1) after gamma, the log2 boost is lerp(GainMapMin, GainMapMax, g), applied as (base + OffsetSdr) × 2^(boost × weight) − OffsetHdr, where the weight rises from 0 at a display headroom of HdrCapacityMin to 1 at HdrCapacityMax. Boosts and capacities are log2 values.

GainMapOptions

How Create(Raster, Raster?, GainMapOptions?) and GainMap make a gain map (HDR Design question 10). The defaults are libultrahdr's: a full-size map with a gain for each of red, green and blue, gamma 1, encoded at quality 95.

HdrMetadata

What an HDR file says about the display it was mastered on and the light levels in it (SMPTE ST 2086 and CTA-861.3, as PNG's mDCV and cLLI chunks store them). Tone mapping takes its source peak from here. Luminances are in cd/m².

IccData

A parsed ICC profile (ICC.1, versions 2 and 4): the header fields, the description and copyright text, and every tag with its bytes. Read-only; FromIcc(IccData) turns it into an encoding that conversion can use.

InkColor

A colour given as inks: named colorants with tints, as PDF's Separation and DeviceN colours, plus the appearance other backends draw. An ink canvas paints each named ink's plate; an RGB canvas, SVG or a raster without the ink draws Appearance. Immutable.

InkSet

The inks a printed page uses, fixed when an ink raster is made: the process inks of an output profile, then named spot and technical inks, at most MaxInks in all. Colours naming an ink the set lacks are drawn through their appearance into the process inks, as PDF does for a device without that colorant. Immutable: WithSpot(string, InkAppearance?, ColorantKind) and WithDisabled(string) return a new set.

TransferFunction

How a color space encodes light: the curve from stored values to linear light and back. Single values use exact double arithmetic; rows of floats use a vectorized form within 1e-5 of it (PQ rows use the double form), the same on every CPU with or without SIMD.

Structs

Chromaticity

A CIE 1931 chromaticity: the x and y coordinates of a color with its brightness left out.

CmykColor

A CMYK color: ink amounts 0 to 1, 0 being no ink, by the plain formula (K = 1 − max(R, G, B), C = (1 − R − K) / (1 − K)) on encoded sRGB. Real inks need a print profile: From(Rgba8, ColorProfile, ColorTransformOptions?) converts through one.

ColorCodePoints

The ITU-T H.273 code points that PNG's cICP chunk, AVIF and JPEG XL use to name a color encoding: colour primaries, transfer characteristics, matrix coefficients and the full-range flag, kept exactly as stored so codes Egami does not know round-trip.

GainMapValues

A value for each of red, green and blue; a one-channel gain map has the same three.

HslColor

An HSL color: hue, saturation and lightness of encoded sRGB, as CSS hsl() defines them.

HsvColor

An HSV (HSB) color: hue, saturation and value of encoded sRGB, as color pickers use them.

IccTag

One tag of an ICC profile: its signature, the type signature its data starts with, and the data.

InkAppearance

How an ink looks at full tint where it cannot be printed: on an RGB canvas, in SVG, in a proof of a raster without its plate, or drawn into the process inks of a raster that lacks it. A process CMYK colour, an sRGB colour or a Lab colour, as PDF's alternate colour spaces allow.

InkTint

One ink of an InkColor and its tint.

LabColor

A CIE Lab* color relative to D50, as ICC and CSS Color 4 define Lab.

LchColor

A CIE LCh color: the polar form of LabColor (D50), with chroma and hue instead of a and b.

OklabColor

An Oklab color (Björn Ottosson, 2020): a perceptual space built on linear sRGB, where equal distances look about equally different and hues stay put when lightness or chroma changes. CSS Color 4's oklab().

OklchColor

An Oklch color: the polar form of OklabColor, CSS Color 4's oklch().

XyzColor

A CIE 1931 XYZ color relative to D65 white (Y = 1 for white), CSS Color 4's XYZ; ToD50() adapts it.

YCbCrColor

A Y'CbCr color: luma and two chroma differences of encoded sRGB, scaled as 8-bit codes / 255: at full range chroma is centered on 128 / 255, as JPEG and H.273 store it, so a byte reads as value × 255. The members without options use BT.601 at full range, as JPEG does; overloads take a YuvMatrix and YuvRange, from the coefficient table planar YUV images share.

Interfaces

IColorValue<TSelf>

A color value in one color model, convertible to and from CIE XYZ (D65) and sRGB pixels, so ColorConvert can convert between any two models and between pixels and values.

Enums

ColorModel

Whether a color encoding has three RGB channels, one gray channel, four CMYK inks, or the inks of an n-colour press.

ColorantKind

What a colorant is for, as PDF and ICC name inks.

GainMapFormat

Where a gain map's metadata came from.

IccProfileClass

What an ICC profile describes, from its header's class field.

InkAppearanceKind

The colour model an InkAppearance is given in.

RenderingIntent

How a color conversion handles colors the target cannot show, with the ICC numbering (0 to 3).

ToneMapping

How HDR light above reference white is brought into the 0..1 range of an SDR encoding.