pub struct WebPDecoder<R> { /* private fields */ }
Expand description
WebP Image format decoder. Currently only supports lossy RGB images or lossless RGBA images.
Implementations§
Source§impl<R> WebPDecoder<R>where
R: Read,
impl<R> WebPDecoder<R>where
R: Read,
Sourcepub fn new(r: R) -> Result<WebPDecoder<R>, ImageError>
pub fn new(r: R) -> Result<WebPDecoder<R>, ImageError>
Create a new WebPDecoder from the Reader r
.
This function takes ownership of the Reader.
Sourcepub fn has_animation(&self) -> bool
pub fn has_animation(&self) -> bool
Returns true if the image as described by the bitstream is animated.
Sourcepub fn set_background_color(
&mut self,
color: Rgba<u8>,
) -> Result<(), ImageError>
pub fn set_background_color( &mut self, color: Rgba<u8>, ) -> Result<(), ImageError>
Sets the background color if the image is an extended and animated webp.
Trait Implementations§
Source§impl<'a, R> AnimationDecoder<'a> for WebPDecoder<R>where
R: 'a + Read,
impl<'a, R> AnimationDecoder<'a> for WebPDecoder<R>where
R: 'a + Read,
Source§fn into_frames(self) -> Frames<'a> ⓘ
fn into_frames(self) -> Frames<'a> ⓘ
Consume the decoder producing a series of frames.
Source§impl<'a, R> ImageDecoder<'a> for WebPDecoder<R>where
R: 'a + Read,
impl<'a, R> ImageDecoder<'a> for WebPDecoder<R>where
R: 'a + Read,
Source§fn dimensions(&self) -> (u32, u32)
fn dimensions(&self) -> (u32, u32)
Returns a tuple containing the width and height of the image
Source§fn color_type(&self) -> ColorType
fn color_type(&self) -> ColorType
Returns the color type of the image data produced by this decoder
Source§fn into_reader(
self,
) -> Result<<WebPDecoder<R> as ImageDecoder<'a>>::Reader, ImageError>
fn into_reader( self, ) -> Result<<WebPDecoder<R> as ImageDecoder<'a>>::Reader, ImageError>
👎Deprecated: Planned for removal. See https://github.com/image-rs/image/issues/1989
Returns a reader that can be used to obtain the bytes of the image. For the best
performance, always try to read at least
scanline_bytes
from the reader at a time. Reading
fewer bytes will cause the reader to perform internal buffering.Source§fn read_image(self, buf: &mut [u8]) -> Result<(), ImageError>
fn read_image(self, buf: &mut [u8]) -> Result<(), ImageError>
Returns all the bytes in the image. Read more
Source§fn icc_profile(&mut self) -> Option<Vec<u8>>
fn icc_profile(&mut self) -> Option<Vec<u8>>
Returns the ICC color profile embedded in the image Read more
Source§fn original_color_type(&self) -> ExtendedColorType
fn original_color_type(&self) -> ExtendedColorType
Returns the color type of the image file before decoding
Source§fn total_bytes(&self) -> u64
fn total_bytes(&self) -> u64
Returns the total number of bytes in the decoded image. Read more
Source§fn scanline_bytes(&self) -> u64
fn scanline_bytes(&self) -> u64
👎Deprecated: Planned for removal. See https://github.com/image-rs/image/issues/1989
Returns the minimum number of bytes that can be efficiently read from this decoder. This may
be as few as 1 or as many as
total_bytes()
.Source§fn read_image_with_progress<F>(
self,
buf: &mut [u8],
progress_callback: F,
) -> Result<(), ImageError>
fn read_image_with_progress<F>( self, buf: &mut [u8], progress_callback: F, ) -> Result<(), ImageError>
👎Deprecated: Use read_image instead. See https://github.com/image-rs/image/issues/1989
Same as
read_image
but periodically calls the provided callback to give updates on loading
progress.Source§fn set_limits(&mut self, limits: Limits) -> Result<(), ImageError>
fn set_limits(&mut self, limits: Limits) -> Result<(), ImageError>
Auto Trait Implementations§
impl<R> Freeze for WebPDecoder<R>where
R: Freeze,
impl<R> RefUnwindSafe for WebPDecoder<R>where
R: RefUnwindSafe,
impl<R> Send for WebPDecoder<R>where
R: Send,
impl<R> Sync for WebPDecoder<R>where
R: Sync,
impl<R> Unpin for WebPDecoder<R>where
R: Unpin,
impl<R> UnwindSafe for WebPDecoder<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<Target, Original> VectorizedInto<Target> for Originalwhere
Target: VectorizedFrom<Original>,
impl<Target, Original> VectorizedInto<Target> for Originalwhere
Target: VectorizedFrom<Original>,
Source§fn vectorized_into(self) -> Target
fn vectorized_into(self) -> Target
Performs the conversion.