Table of Contents

Namespace Egami.Pixels

Classes

PixelConvert

Converts spans of pixels from one pixel type to another.

Structs

Abgr8

A pixel with 8-bit alpha, blue, green and red channels, in that order, with straight alpha. Matches the bytes of a little-endian 32-bit RGBA value read as an integer.

Alpha8

A pixel with one 8-bit alpha channel: a mask, or glyph coverage. As a color it is black with that alpha; converting a color to it keeps only the alpha, so a type without alpha gives 255.

Argb8

A pixel with 8-bit alpha, red, green and blue channels, in that order, with straight alpha. Matches the byte order of big-endian ARGB buffers, such as Java's and some TIFF and PSD files.

Bgr555

A 16-bit packed pixel: blue in bits 0 to 4, green in bits 5 to 9, red in bits 10 to 14, and no alpha; bit 15 is unused and written as 0. The same memory as the default 16-bit BMP, 15-bit TGA and the GDI+ 16-bit RGB 555 format. Widening and narrowing both round to the nearest value, so every value with bit 15 clear survives a round trip through Rgba8.

Bgr565

A 16-bit packed pixel: blue in bits 0 to 4, green in bits 5 to 10, red in bits 11 to 15, and no alpha. The same memory as Skia's and Android's RGB 565 and the 16-bit BMP 5-6-5 bit field. Widening and narrowing both round to the nearest value, so every 16-bit value survives a round trip through Rgba8.

Bgr8

A pixel with 8-bit blue, green and red channels, in that order, and no alpha.

Bgra4444

A 16-bit packed pixel: blue in bits 0 to 3, green in 4 to 7, red in 8 to 11 and straight alpha in 12 to 15. The same memory as the DXGI and Vulkan B4G4R4A4 formats. Each level widens to 8 bits by multiplying by 17, and narrowing rounds to nearest.

Bgra5551

A 16-bit packed pixel: blue in bits 0 to 4, green in bits 5 to 9, red in bits 10 to 14 and a 1-bit straight alpha in bit 15 (1 is opaque). The same memory as 16-bit TGA with one attribute bit, the BMP 1-5-5-5 bit field and the GDI+ 16-bit ARGB 1555 format. Color levels round to the nearest value; alpha 128 and above narrows to opaque. Every 16-bit value survives a round trip through Rgba8.

Bgra8

A pixel with 8-bit blue, green, red and straight alpha channels, in that order.

Cmyk16

A pixel with 16-bit cyan, magenta, yellow and black ink amounts, in that order, 0 meaning no ink. 16-bit CMYK TIFF and PSD.

Cmyk8

A pixel with 8-bit cyan, magenta, yellow and black ink amounts, in that order, 0 meaning no ink. CMYK JPEG, TIFF and PSD.

Gray16

A pixel with one 16-bit luminance channel and no alpha.

Gray8

A pixel with one 8-bit luminance channel and no alpha.

GrayAlpha16

A pixel with 16-bit luminance and straight alpha channels, in that order.

GrayAlpha8

A pixel with 8-bit luminance and straight alpha channels, in that order.

GrayF32

A pixel with one 32-bit float luminance channel, nominally 0 to 1, and no alpha: PFM gray maps, depth and height maps.

PixelLayoutInfo

Describes the memory layout of a pixel type.

PremulBgra8

A pixel with 8-bit blue, green and red channels premultiplied by the alpha channel, in that order: the layout of Windows and GPU surfaces.

PremulRgba8

A pixel with 8-bit red, green and blue channels premultiplied by the alpha channel, in that order: Skia's N32 premultiplied.

PremulRgbaF32

A pixel with 32-bit float red, green and blue channels premultiplied by the alpha channel, in that order, for float compositing and blending. The conversions take and return straight colors; values are not clamped, except that a premultiplied pixel with zero alpha has no color.

Rgb10A2

A 32-bit packed pixel: red in bits 0 to 9, green in 10 to 19, blue in 20 to 29 and straight alpha in 30 and 31. The same memory as the DXGI R10G10B10A2 and Vulkan A2B10G10R10 formats, used by 10-bit displays. Ten-bit levels round to the nearest 16-bit value and convert through Rgba16 exactly; two-bit alpha widens by multiplying.

Rgb16

A pixel with 16-bit red, green and blue channels, in that order, and no alpha.

Rgb8

A pixel with 8-bit red, green and blue channels, in that order, and no alpha.

RgbF32

A pixel with 32-bit float red, green and blue channels, in that order, nominally 0 to 1, and no alpha.

Rgba16

A pixel with 16-bit red, green, blue and straight alpha channels, in that order.

Rgba8

A pixel with 8-bit red, green, blue and straight alpha channels, in that order. Egami's default working type.

RgbaF16

A pixel with 16-bit float (Half) red, green, blue and straight alpha channels, in that order, nominally 0 to 1. Values outside 0..1 (HDR) are kept until written to an integer type; conversion to and from float rounds as (Half)f does: to nearest even, with values above 65,504 becoming infinity.

RgbaF32

A pixel with 32-bit float red, green, blue and straight alpha channels, in that order, nominally 0 to 1.

YuvColor

How the samples of a YuvRaster turn into RGB: the matrix, the range and where chroma sits. Every load, wrap and conversion states one, so a picture is never read with a guessed matrix.

Interfaces

IPixelType<TSelf>

A pixel type: an unmanaged struct holding one pixel. The conversions (ToScaled, FromScaled, ToRgba8, FromRgba8) always use sRGB-encoded values with straight (not premultiplied) alpha; Layout says how the pixel is stored, so Egami can take faster paths for layouts it knows. Types from outside Egami may use any layout, with Other for ones Egami does not know.

Enums

AlphaKind

How a pixel type stores alpha.

ChromaFormat

How a YuvRaster stores chroma: at what resolution against luma, or not at all.

ChromaSiting

Where each chroma sample of a subsampled picture (4:2:0, 4:2:2, 4:1:1 or 4:1:0) sits against the luma samples it covers. Conversions filter chroma to match, so colors line up with edges. Ignored for 4:4:4 and 4:0:0.

PixelChannelOrder

The order in which a pixel type stores its channels.

PixelChannelType

The storage type of every channel in a pixel type.

YuvMatrix

The matrix between RGB and luma-chroma (Y'CbCr) values, as ITU-T H.273 names them. Shared by YCbCrColor and planar YUV images, so their coefficients never disagree.

YuvPackedFormat

The interleaved YUV layouts that operating system decoders, GPUs and webcams hand out, which a YuvRaster copies to and from its planes with CopyFromPacked(YuvPackedFormat, ReadOnlySpan<byte>, int, ReadOnlySpan<byte>, int) and CopyToPacked(YuvPackedFormat, Span<byte>, int, Span<byte>, int).

YuvRange

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