Skip to main content

WebPDecoder

Struct WebPDecoder 

Source
pub struct WebPDecoder { /* private fields */ }
Expand description

Decodes a WebP stream.

Implementations§

Source§

impl WebPDecoder

Source

pub fn new<S: Source>(source: S, limits: Limits) -> Result<Self>

Read the container and decode the image.

This decodes eagerly: chunks may come in any order the container allows, and neither bitstream yields finished rows from a prefix of the file without the decoder holding its whole working state.

§Errors

Returns PixelsError::Malformed for a stream the wrapped decoder rejects, PixelsError::Unsupported for a WebP feature it does not implement, or PixelsError::LimitExceeded if the image exceeds limits.

Trait Implementations§

Source§

impl Debug for WebPDecoder

Source§

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

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

impl Decoder for WebPDecoder

Source§

fn descriptor(&self) -> ImageDescriptor

The shape of the image, known after the header is parsed.
Source§

fn orientation(&self) -> Orientation

How the stored image must be turned to display upright, as its metadata declares. Read more
Source§

fn icc_profile(&self) -> Option<&[u8]>

The embedded ICC colour profile, if the file carries one. Read more
Source§

fn animation(&self) -> Option<Animation>

The source’s animation, if it has more than one frame. Read more
Source§

fn capability(&self) -> DecodeCapability

What this decoder can produce without a full decode.
Source§

fn read_row(&mut self, out: &mut [u8]) -> Result<()>

Decode the next row, top to bottom, into out. Read more
Source§

fn read_region( &mut self, region: Region, out: &mut TileMut<'_>, ) -> Result<(), PixelsError>

Decode an arbitrary region into out. Read more
Source§

fn reduced_descriptor(&self, target: (u32, u32)) -> Option<ImageDescriptor>

What this decoder would produce if asked for target or larger, when the format lets it reach that size more cheaply than a full decode. Read more
Source§

fn reduce_to(&mut self, descriptor: ImageDescriptor) -> Result<(), PixelsError>

Commit to producing descriptor, which Decoder::reduced_descriptor must have returned. Read more

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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.