Skip to main content

PlanarImage

Struct PlanarImage 

Source
pub struct PlanarImage<T: Pixel> {
    pub width: usize,
    pub height: usize,
    pub bit_depth: BitDepth,
    pub planes: [Vec<T>; 4],
}

Fields§

§width: usize§height: usize§bit_depth: BitDepth§planes: [Vec<T>; 4]

Implementations§

Source§

impl<T: Pixel> PlanarImage<T>

Source

pub fn from_interleaved_rgb( width: usize, height: usize, bit_depth: BitDepth, rgb: &[T], ) -> Result<Self, EncodeError>

Build from interleaved RGB samples (r,g,b,r,g,b,...). AV1 identity matrix mapping: plane0=G, plane1=B, plane2=R. No alpha.

Source

pub fn from_interleaved_rgba( width: usize, height: usize, bit_depth: BitDepth, rgba: &[T], ) -> Result<Self, EncodeError>

Build from interleaved RGBA samples (r,g,b,a,r,g,b,a,...) in a single pass: plane0=G, plane1=B, plane2=R, plane3=A. This is the deinterleave the *_with_alpha paths use — the color planes and the alpha plane are split once, with no intermediate RGB buffer.

Source

pub fn from_luma( width: usize, height: usize, bit_depth: BitDepth, luma: &[T], ) -> Result<Self, EncodeError>

Build a monochrome image from a single luma plane. No alpha.

Source

pub fn from_interleaved_gray_alpha( width: usize, height: usize, bit_depth: BitDepth, gray_alpha: &[T], ) -> Result<Self, EncodeError>

Build a monochrome-plus-alpha image from interleaved gray/alpha samples (l,a,l,a,...) in a single pass: plane0=luma, plane3=alpha (planes 1/2 stay empty). Mirrors Self::from_interleaved_rgba for the 2-channel gray+alpha case.

Source

pub fn to_interleaved_rgb(&self) -> Vec<T>

Reconstruct interleaved RGB from the GBR planes (alpha is dropped).

Auto Trait Implementations§

§

impl<T> Freeze for PlanarImage<T>

§

impl<T> RefUnwindSafe for PlanarImage<T>
where T: RefUnwindSafe,

§

impl<T> Send for PlanarImage<T>

§

impl<T> Sync for PlanarImage<T>

§

impl<T> Unpin for PlanarImage<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for PlanarImage<T>

§

impl<T> UnwindSafe for PlanarImage<T>
where T: UnwindSafe,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.