Struct bevy_retrograde::core::image::jpeg::JpegDecoder [−]
pub struct JpegDecoder<R> { /* fields omitted */ }
Expand description
JPEG decoder
Implementations
impl<R> JpegDecoder<R> where
R: Read,
impl<R> JpegDecoder<R> where
R: Read,
pub fn new(r: R) -> Result<JpegDecoder<R>, ImageError>
pub fn new(r: R) -> Result<JpegDecoder<R>, ImageError>
Create a new decoder that decodes from the stream r
Configure the decoder to scale the image during decoding.
This efficiently scales the image by the smallest supported scale factor that produces an image larger than or equal to the requested size in at least one axis. The currently implemented scale factors are 1/8, 1/4, 1/2 and 1.
To generate a thumbnail of an exact size, pass the desired size and then scale to the final size using a traditional resampling algorithm.
The size of the image to be loaded, with the scale factor applied, is returned.
Trait Implementations
impl<'a, R> ImageDecoder<'a> for JpegDecoder<R> where
R: 'a + Read,
impl<'a, R> ImageDecoder<'a> for JpegDecoder<R> where
R: 'a + Read,
type Reader = JpegReader<R>
type Reader = JpegReader<R>
The type of reader produced by into_reader
.
pub fn dimensions(&self) -> (u32, u32)
pub fn dimensions(&self) -> (u32, u32)
Returns a tuple containing the width and height of the image
pub fn color_type(&self) -> ColorType
pub fn color_type(&self) -> ColorType
Returns the color type of the image data produced by this decoder
pub fn into_reader(
self
) -> Result<<JpegDecoder<R> as ImageDecoder<'a>>::Reader, ImageError>
pub fn into_reader(
self
) -> Result<<JpegDecoder<R> as ImageDecoder<'a>>::Reader, ImageError>
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. Read more
pub fn read_image(self, buf: &mut [u8]) -> Result<(), ImageError>
pub fn read_image(self, buf: &mut [u8]) -> Result<(), ImageError>
Returns all the bytes in the image. Read more
fn original_color_type(&self) -> ExtendedColorType
fn original_color_type(&self) -> ExtendedColorType
Retuns the color type of the image file before decoding
fn total_bytes(&self) -> u64
fn total_bytes(&self) -> u64
Returns the total number of bytes in the decoded image. Read more
fn scanline_bytes(&self) -> u64
fn scanline_bytes(&self) -> u64
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()
. Read more
fn read_image_with_progress<F>(
self,
buf: &mut [u8],
progress_callback: F
) -> Result<(), ImageError> where
F: Fn(Progress),
fn read_image_with_progress<F>(
self,
buf: &mut [u8],
progress_callback: F
) -> Result<(), ImageError> where
F: Fn(Progress),
Same as read_image
but periodically calls the provided callback to give updates on loading
progress. Read more
Auto Trait Implementations
impl<R> RefUnwindSafe for JpegDecoder<R> where
R: RefUnwindSafe,
impl<R> Send for JpegDecoder<R> where
R: Send,
impl<R> Sync for JpegDecoder<R> where
R: Sync,
impl<R> Unpin for JpegDecoder<R> where
R: Unpin,
impl<R> UnwindSafe for JpegDecoder<R> where
R: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V