Skip to main content

Crate gamut_core

Crate gamut_core 

Source
Expand description

Core traits, image buffers, dimensions, and error types shared across the gamut codecs.

This crate is dependency-free with respect to the format crates: every codec in the workspace builds on the EncodeImage / DecodeImage traits, the branded ImageRef / ImageBuf buffers, and the Error type defined here, so that callers get a single, consistent error surface regardless of format.

Structs§

Bilevel
8-bit bilevel: one byte per pixel, 0 = black and non-zero = white. Distinct from Gray8 so a grayscale buffer cannot be mistaken for a 1-bit image.
Cmyk8
8-bit CMYK: four interleaved ink bytes per pixel. Distinct from Rgba8 despite the shared channel count.
Dimensions
Width and height of an image, in pixels.
Gray8
8-bit grayscale: one luminance byte per pixel.
Gray16
16-bit grayscale: one u16 luminance sample per pixel (high-bit-depth).
ImageBuf
An owned, length-validated interleaved image of pixel type P.
ImageRef
A borrowed, length-validated view of an interleaved image of pixel type P.
Indexed8
8-bit palette indices: one index byte per pixel into a separate colour table. Distinct from Gray8 so indices cannot be mistaken for luminance.
Rgb8
8-bit RGB: three interleaved bytes per pixel, row-major.
Rgb16
16-bit RGB: three interleaved u16 samples per pixel (high-bit-depth).
Rgba8
8-bit RGBA: four interleaved bytes per pixel (unassociated alpha).
Rgba16
16-bit RGBA: four interleaved u16 samples per pixel (high-bit-depth).

Enums§

ColorModel
The colour interpretation of a pixel’s channels.
Error
Errors produced by gamut encoders and decoders.

Traits§

DecodeImage
Decodes a compressed byte stream into an owned ImageBuf of pixel layout P.
EncodeImage
Encodes an ImageRef of a specific pixel layout P into a compressed byte stream.
Pixel
Compile-time description of one interleaved pixel layout.
Sample
A pixel-sample storage primitive: u8 (8-bit) or u16 (10/12/16-bit, high-bit-depth).

Type Aliases§

Result
Convenience result type for gamut operations.