pub struct WebPDecoder { /* private fields */ }Expand description
Decodes a WebP stream.
Implementations§
Source§impl WebPDecoder
impl WebPDecoder
Sourcepub fn new<S: Source>(source: S, limits: Limits) -> Result<Self>
pub fn new<S: Source>(source: S, limits: Limits) -> Result<Self>
Read the file and parse its container; the pixels decode when the first row is read.
The whole file is read here: chunks may come in any order the container allows, so the size, alpha, orientation and ICC profile are only known once every chunk has been seen. Decoding the bitstream is what costs, and it waits, so opening a WebP to ask its size or metadata is a header parse. The image then decodes in one piece: 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 container or bitstream
header it rejects, PixelsError::Unsupported for a WebP feature it
does not implement, or PixelsError::LimitExceeded if the image
exceeds limits. A bitstream that is damaged past its header is
reported by the first Decoder::read_row.
Trait Implementations§
Source§impl Debug for WebPDecoder
impl Debug for WebPDecoder
Source§impl Decoder for WebPDecoder
impl Decoder for WebPDecoder
Source§fn descriptor(&self) -> ImageDescriptor
fn descriptor(&self) -> ImageDescriptor
Source§fn orientation(&self) -> Orientation
fn orientation(&self) -> Orientation
Source§fn icc_profile(&self) -> Option<&[u8]>
fn icc_profile(&self) -> Option<&[u8]>
Source§fn animation(&self) -> Option<Animation>
fn animation(&self) -> Option<Animation>
Source§fn capability(&self) -> DecodeCapability
fn capability(&self) -> DecodeCapability
Source§fn read_row(&mut self, out: &mut [u8]) -> Result<()>
fn read_row(&mut self, out: &mut [u8]) -> Result<()>
out. Read moreSource§fn read_region(
&mut self,
region: Region,
out: &mut TileMut<'_>,
) -> Result<(), PixelsError>
fn read_region( &mut self, region: Region, out: &mut TileMut<'_>, ) -> Result<(), PixelsError>
out. Read moreSource§fn reduced_descriptor(&self, target: (u32, u32)) -> Option<ImageDescriptor>
fn reduced_descriptor(&self, target: (u32, u32)) -> Option<ImageDescriptor>
target or larger, when
the format lets it reach that size more cheaply than a full decode. Read more