Skip to main content

Pixel

Trait Pixel 

Source
pub trait Pixel:
    Sealed
    + Copy
    + 'static {
    type Sample: Sample;

    const CHANNELS: usize;
    const MODEL: ColorModel;
    const BYTES_PER_PIXEL: usize = _;
}
Expand description

Compile-time description of one interleaved pixel layout.

Sealed: implemented only by the zero-sized marker types in this module. A buffer is branded with a Pixel type so its channel count, sample primitive, and colour model are known statically; codecs implement crate::EncodeImage<P> / crate::DecodeImage<P> for exactly the P they support, making an unsupported format a compile error.

Required Associated Constants§

Source

const CHANNELS: usize

Samples per pixel.

Source

const MODEL: ColorModel

The colour interpretation of those samples.

Provided Associated Constants§

Source

const BYTES_PER_PIXEL: usize = _

Bytes one pixel occupies in an interleaved buffer (CHANNELS * size_of::<Sample>()).

Required Associated Types§

Source

type Sample: Sample

The storage primitive of each sample (u8 or u16).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Pixel for Bilevel

Source§

const CHANNELS: usize = 1

Source§

const MODEL: ColorModel = ColorModel::Bilevel

Source§

type Sample = u8

Source§

impl Pixel for Cmyk8

Source§

const CHANNELS: usize = 4

Source§

const MODEL: ColorModel = ColorModel::Cmyk

Source§

type Sample = u8

Source§

impl Pixel for Gray8

Source§

const CHANNELS: usize = 1

Source§

const MODEL: ColorModel = ColorModel::Gray

Source§

type Sample = u8

Source§

impl Pixel for Gray16

Source§

const CHANNELS: usize = 1

Source§

const MODEL: ColorModel = ColorModel::Gray

Source§

type Sample = u16

Source§

impl Pixel for Indexed8

Source§

const CHANNELS: usize = 1

Source§

const MODEL: ColorModel = ColorModel::Indexed

Source§

type Sample = u8

Source§

impl Pixel for Rgb8

Source§

const CHANNELS: usize = 3

Source§

const MODEL: ColorModel = ColorModel::Rgb

Source§

type Sample = u8

Source§

impl Pixel for Rgb16

Source§

const CHANNELS: usize = 3

Source§

const MODEL: ColorModel = ColorModel::Rgb

Source§

type Sample = u16

Source§

impl Pixel for Rgba8

Source§

const CHANNELS: usize = 4

Source§

const MODEL: ColorModel = ColorModel::Rgba

Source§

type Sample = u8

Source§

impl Pixel for Rgba16

Source§

const CHANNELS: usize = 4

Source§

const MODEL: ColorModel = ColorModel::Rgba

Source§

type Sample = u16