Table of Contents

Enum YuvRange

Namespace
Egami.Pixels
Assembly
Egami.dll

Whether luma-chroma values use the whole range or the video range.

public enum YuvRange

Fields

Full = 0

Every value from 0 to the maximum, as JPEG and image formats use.

Limited = 1

The video range: luma 16 to 235 and chroma 16 to 240 at 8 bits, scaled for other depths.

Examples

// Color values in the models apps ask for, from and to pixels, and between each other.
Rgba8 orange = new(240, 128, 32, 255);
HslColor hsl = HslColor.From(orange);                          // hue 28°, saturation 0.87, lightness 0.53
LabColor lab = ColorConvert.Convert<HslColor, LabColor>(hsl);  // through XYZ
OklchColor oklch = OklchColor.From(orange);
YCbCrColor jpeg = YCbCrColor.From(orange);                     // BT.601 full range, as JPEG
YCbCrColor video = YCbCrColor.From(orange, YuvMatrix.Bt709, YuvRange.Limited);

// Color difference: CIEDE2000 on Lab, distance on Oklab.
double deltaE = lab.DeltaE2000(LabColor.From(new Rgba8(235, 130, 40, 255)));

// Whole rows at once, from any pixel type and encoding.
Rgba8[] pixels = [orange, new(10, 20, 30, 255)];
OklabColor[] row = new OklabColor[pixels.Length];
ColorConvert.FromPixels<Rgba8, OklabColor>(pixels, row);
ColorConvert.FromPixels<Rgba8, OklabColor>(pixels, row, ColorProfile.DisplayP3);   // the same pixels read as Display P3