Skip to main content

Pixel

Trait Pixel 

Source
pub trait Pixel: Pod {
    const DESCRIPTOR: PixelDescriptor;
}
Expand description

Compile-time pixel format descriptor.

Implemented for pixel types to associate them with their PixelDescriptor. This enables typed PixelSlice construction where the type system enforces format correctness.

The trait is open (not sealed) — custom pixel types can implement it. The new_typed() constructors include a compile-time assertion that size_of::<P>() == P::DESCRIPTOR.bytes_per_pixel() to catch bad impls.

Required Associated Constants§

Source

const DESCRIPTOR: PixelDescriptor

The pixel format descriptor for this type.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Pixel for Bgra<u8>

Available on crate feature rgb only.
Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::BGRA8

Source§

impl Pixel for Gray_v08<f32>

Available on crate feature rgb only.
Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::GRAYF32

Source§

impl Pixel for Gray_v08<u8>

Available on crate feature rgb only.
Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::GRAY8

Source§

impl Pixel for Gray_v08<u16>

Available on crate feature rgb only.
Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::GRAY16

Source§

impl Pixel for Rgb<f32>

Available on crate feature rgb only.
Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::RGBF32

Source§

impl Pixel for Rgb<u8>

Available on crate feature rgb only.
Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::RGB8

Source§

impl Pixel for Rgb<u16>

Available on crate feature rgb only.
Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::RGB16

Source§

impl Pixel for Rgba<f32>

Available on crate feature rgb only.
Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::RGBAF32

Source§

impl Pixel for Rgba<u8>

Available on crate feature rgb only.
Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::RGBA8

Source§

impl Pixel for Rgba<u16>

Available on crate feature rgb only.
Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::RGBA16

Implementors§

Source§

impl Pixel for Bgrx

Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::BGRX8

Source§

impl Pixel for GrayAlpha8

Available on crate feature rgb only.
Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::GRAYA8

Source§

impl Pixel for GrayAlpha16

Available on crate feature rgb only.
Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::GRAYA16

Source§

impl Pixel for GrayAlphaF32

Available on crate feature rgb only.
Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::GRAYAF32

Source§

impl Pixel for Rgbx

Source§

const DESCRIPTOR: PixelDescriptor = PixelDescriptor::RGBX8