Struct PngDecoder
struct PngDecoder<R: BufRead + Seek> { ... }
PNG decoder
Implementations
impl<R: BufRead + Seek> PngDecoder<R>
fn new(r: R) -> ImageResult<PngDecoder<R>>Creates a new decoder that decodes from the stream
rfn with_limits(r: R, limits: Limits) -> ImageResult<PngDecoder<R>>Creates a new decoder that decodes from the stream
rwith the given limits.fn gamma_value(self: &Self) -> ImageResult<Option<f64>>Returns the gamma value of the image or None if no gamma value is indicated.
If an sRGB chunk is present this method returns a gamma value of 0.45455 and ignores the value in the gAMA chunk. This is the recommended behavior according to the PNG standard:
When the sRGB chunk is present, [...] decoders that recognize the sRGB chunk but are not capable of colour management are recommended to ignore the gAMA and cHRM chunks, and use the values given above as if they had appeared in gAMA and cHRM chunks.
fn apng(self: Self) -> ImageResult<ApngDecoder<R>>Turn this into an iterator over the animation frames.
Reading the complete animation requires more memory than reading the data from the IDAT frame–multiple frame buffers need to be reserved at the same time. We further do not support compositing 16-bit colors. In any case this would be lossy as the interface of animation decoders does not support 16-bit colors.
If something is not supported or a limit is violated then the decoding step that requires them will fail and an error will be returned instead of the frame. No further frames will be returned.
fn is_apng(self: &Self) -> ImageResult<bool>Returns if the image contains an animation.
Note that the file itself decides if the default image is considered to be part of the animation. When it is not the common interpretation is to use it as a thumbnail.
If a non-animated image is converted into an
ApngDecoderthen its iterator is empty.
impl<R> Freeze for PngDecoder<R>
impl<R> RefUnwindSafe for PngDecoder<R>
impl<R> Send for PngDecoder<R>
impl<R> Sync for PngDecoder<R>
impl<R> Unpin for PngDecoder<R>
impl<R> UnwindSafe for PngDecoder<R>
impl<R: BufRead + Seek> ImageDecoder for PngDecoder<R>
fn dimensions(self: &Self) -> (u32, u32)fn color_type(self: &Self) -> ColorTypefn icc_profile(self: &mut Self) -> ImageResult<Option<Vec<u8>>>fn read_image(self: Self, buf: &mut [u8]) -> ImageResult<()>fn read_image_boxed(self: Box<Self>, buf: &mut [u8]) -> ImageResult<()>fn set_limits(self: &mut Self, limits: Limits) -> ImageResult<()>
impl<T> Any for PngDecoder<R>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for PngDecoder<R>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for PngDecoder<R>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for PngDecoder<R>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Pointable for PngDecoder<R>
unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T, U> Into for PngDecoder<R>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for PngDecoder<R>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for PngDecoder<R>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>