Skip to main content

PixelLayout

Enum PixelLayout 

Source
pub enum PixelLayout {
    Gray {
        sample: SampleStorage,
    },
    GrayAlphaInterleaved {
        sample: SampleStorage,
        order: GrayAlphaOrder,
        alpha: AlphaAssociation,
    },
    GrayAlphaPlanar {
        gray: SampleStorage,
        alpha_sample: SampleStorage,
        alpha: AlphaAssociation,
    },
    RgbInterleaved {
        sample: SampleStorage,
        order: RgbOrder,
    },
    RgbPlanar {
        sample: SampleStorage,
    },
    RgbaInterleaved {
        sample: SampleStorage,
        order: RgbaOrder,
        alpha: AlphaAssociation,
    },
    RgbaPlanar {
        color: SampleStorage,
        alpha_sample: SampleStorage,
        alpha: AlphaAssociation,
    },
    YcbcrPlanar {
        luma: SampleStorage,
        chroma: SampleStorage,
        subsampling: ChromaSubsampling,
    },
    YcbcrSemiPlanar {
        luma: SampleStorage,
        chroma: SampleStorage,
        subsampling: ChromaSubsampling,
        order: ChromaOrder,
    },
    YcbcrAlphaPlanar {
        luma: SampleStorage,
        chroma: SampleStorage,
        alpha_sample: SampleStorage,
        subsampling: ChromaSubsampling,
        alpha: AlphaAssociation,
    },
    YcbcrAlphaSemiPlanar {
        luma: SampleStorage,
        chroma: SampleStorage,
        alpha_sample: SampleStorage,
        subsampling: ChromaSubsampling,
        order: ChromaOrder,
        alpha: AlphaAssociation,
    },
}
Expand description

A format-neutral pixel layout whose channel, alpha, chroma, and plane relationships are fixed by its variant.

Variants§

§

Gray

One full-resolution gray plane.

Fields

§sample: SampleStorage

Gray sample storage.

§

GrayAlphaInterleaved

One full-resolution interleaved gray/alpha plane.

Fields

§sample: SampleStorage

Shared gray and alpha storage.

§order: GrayAlphaOrder

Interleaved channel order.

§alpha: AlphaAssociation

Alpha association.

§

GrayAlphaPlanar

Separate full-resolution gray and alpha planes, in that order.

Fields

§gray: SampleStorage

Gray-plane storage.

§alpha_sample: SampleStorage

Alpha-plane storage.

§alpha: AlphaAssociation

Alpha association.

§

RgbInterleaved

One full-resolution interleaved RGB plane.

Fields

§sample: SampleStorage

Shared channel storage.

§order: RgbOrder

Interleaved channel order.

§

RgbPlanar

Separate full-resolution R, G, and B planes, in that order.

Fields

§sample: SampleStorage

Shared channel storage.

§

RgbaInterleaved

One full-resolution interleaved RGB/alpha plane.

Fields

§sample: SampleStorage

Shared channel storage.

§order: RgbaOrder

Interleaved channel order.

§alpha: AlphaAssociation

Alpha association.

§

RgbaPlanar

Separate full-resolution R, G, B, and alpha planes, in that order.

Fields

§color: SampleStorage

Shared RGB-plane storage.

§alpha_sample: SampleStorage

Alpha-plane storage.

§alpha: AlphaAssociation

Alpha association.

§

YcbcrPlanar

Separate Y, Cb, and Cr planes, in that order.

Fields

§luma: SampleStorage

Luma-plane storage.

§chroma: SampleStorage

Shared chroma-plane storage.

§subsampling: ChromaSubsampling

Chroma sampling factors.

§

YcbcrSemiPlanar

A full-resolution Y plane followed by one interleaved chroma plane.

Fields

§luma: SampleStorage

Luma-plane storage.

§chroma: SampleStorage

Chroma-plane channel storage.

§subsampling: ChromaSubsampling

Chroma sampling factors.

§order: ChromaOrder

Interleaved chroma order.

§

YcbcrAlphaPlanar

Separate Y, Cb, Cr, and full-resolution alpha planes, in that order.

Fields

§luma: SampleStorage

Luma-plane storage.

§chroma: SampleStorage

Shared chroma-plane storage.

§alpha_sample: SampleStorage

Alpha-plane storage.

§subsampling: ChromaSubsampling

Chroma sampling factors.

§alpha: AlphaAssociation

Alpha association.

§

YcbcrAlphaSemiPlanar

Y, interleaved chroma, and full-resolution alpha planes, in that order.

Fields

§luma: SampleStorage

Luma-plane storage.

§chroma: SampleStorage

Chroma-plane channel storage.

§alpha_sample: SampleStorage

Alpha-plane storage.

§subsampling: ChromaSubsampling

Chroma sampling factors.

§order: ChromaOrder

Interleaved chroma order.

§alpha: AlphaAssociation

Alpha association.

Implementations§

Source§

impl PixelLayout

Source

pub const fn plane_count(self) -> u8

Returns the exact number of planes required by the variant.

Source

pub const fn alpha_association(self) -> Option<AlphaAssociation>

Returns the alpha association only for layouts that contain alpha.

Source

pub const fn chroma_subsampling(self) -> Option<ChromaSubsampling>

Returns chroma subsampling only for YCbCr layouts.

Source

pub const fn plane(self, index: u8) -> Option<PixelPlane>

Returns one logical plane, or None when the index is out of range.

Source

pub fn validate_planes( self, image: Dimensions, planes: &[PlaneLayout], ) -> PixelLayoutResult<OutputLength>

Validates concrete byte planes against the exact logical layout.

Plane count, sampled row count, and tightly packed used row bytes must match. Stride padding and gaps between planes remain permitted by PlaneLayout; overlap and ordering remain forbidden.

§Errors

Rejects mismatched plane relationships, row-size arithmetic failure, or invalid concrete plane ordering and overlap.

Trait Implementations§

Source§

impl Clone for PixelLayout

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PixelLayout

Source§

impl Debug for PixelLayout

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PixelLayout

Source§

impl Hash for PixelLayout

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for PixelLayout

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PixelLayout

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.