Skip to main content

AlphHeader

Struct AlphHeader 

Source
pub struct AlphHeader {
    pub compression: AlphCompression,
    pub filtering: AlphFiltering,
    pub preprocessing: AlphPreprocessing,
    pub reserved: u8,
    pub info_byte: u8,
}
Expand description

Decoded §2.7.1.2 ALPH info byte plus the offset at which the alpha bitstream begins inside the chunk payload.

Constructed via AlphHeader::parse. The actual alpha bitstream (raw or VP8L-compressed) is not decoded — this layer’s job is to surface the 2-bit Rsv / P / F / C decomposition. The payload after byte 0 — payload[1..] — is the §2.7.1.2 “Alpha bitstream” of Chunk Size - 1 bytes; callers that need it should slice the chunk payload at Self::bitstream_offset.

Fields§

§compression: AlphCompression

C field — compression method (§2.7.1.2).

§filtering: AlphFiltering

F field — filtering method (§2.7.1.2).

§preprocessing: AlphPreprocessing

P field — preprocessing hint (§2.7.1.2).

§reserved: u8

Rsv field — raw 2-bit value from bits 7..6 of the info byte. §2.7.1.2 says “MUST be 0. Readers MUST ignore this field.” — we surface the raw value for observability without rejecting.

§info_byte: u8

Raw info byte, preserved for round-trip and trace assertions.

Implementations§

Source§

impl AlphHeader

Source

pub fn parse(payload: &[u8]) -> Result<Self, AlphError>

Parse the ALPH chunk payload’s §2.7.1.2 info byte.

payload is the whole §2.3 chunk payload (i.e. the slice returned by crate::container::WebpChunk::payload for a chunk whose FourCC is crate::container::fourcc::ALPH). Only the first byte is consumed by this layer; the remainder is the alpha bitstream callers must hand off to a later VP8L or raw decode pass.

Source

pub const fn bitstream_offset(&self) -> usize

Offset (within the ALPH chunk payload) at which the alpha bitstream begins. Always 1 per §2.7.1.2 — the info byte is followed immediately by the bitstream.

Trait Implementations§

Source§

impl Clone for AlphHeader

Source§

fn clone(&self) -> AlphHeader

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 AlphHeader

Source§

impl Debug for AlphHeader

Source§

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

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

impl Eq for AlphHeader

Source§

impl PartialEq for AlphHeader

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for AlphHeader

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 = 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.