Skip to main content

PngDecoder

Struct PngDecoder 

Source
pub struct PngDecoder<S>
where S: Source,
{ /* private fields */ }
Expand description

Decodes a PNG stream.

Implementations§

Source§

impl<S> PngDecoder<S>
where S: Source,

Source

pub fn new(source: S, limits: Limits) -> Result<PngDecoder<S>, PixelsError>

Parse the signature, IHDR and every chunk before the image data.

§Errors

Returns PixelsError::Malformed for a bad signature, header or pre-IDAT chunk, or PixelsError::LimitExceeded if the dimensions exceed limits.

Source

pub const fn header(&self) -> Header

The parsed header.

Trait Implementations§

Source§

impl<S> Debug for PngDecoder<S>
where S: Debug + Source,

Source§

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

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

impl<S> Decoder for PngDecoder<S>
where S: Source + Debug,

Source§

fn orientation(&self) -> Orientation

From an eXIf chunk before the image data. One after it is not seen: by then the pipeline has been built, and §5.6 puts eXIf first.

Source§

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

From an iCCP chunk before the image data.

Source§

fn descriptor(&self) -> ImageDescriptor

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

fn capability(&self) -> DecodeCapability

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

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

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

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

The source’s animation, if it has more than one frame. 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§

§

impl<S> Freeze for PngDecoder<S>
where Option<Prelude<S>>: Freeze, Option<Box<Streaming<S>>>: Freeze,

§

impl<S> RefUnwindSafe for PngDecoder<S>
where Option<Prelude<S>>: RefUnwindSafe, Option<Box<Streaming<S>>>: RefUnwindSafe,

§

impl<S> Send for PngDecoder<S>
where Option<Prelude<S>>: Send, Option<Box<Streaming<S>>>: Send,

§

impl<S> Sync for PngDecoder<S>
where Option<Prelude<S>>: Sync, Option<Box<Streaming<S>>>: Sync,

§

impl<S> Unpin for PngDecoder<S>
where Option<Prelude<S>>: Unpin, Option<Box<Streaming<S>>>: Unpin,

§

impl<S> UnsafeUnpin for PngDecoder<S>
where Option<Prelude<S>>: UnsafeUnpin, Option<Box<Streaming<S>>>: UnsafeUnpin,

§

impl<S> UnwindSafe for PngDecoder<S>
where Option<Prelude<S>>: UnwindSafe, Option<Box<Streaming<S>>>: UnwindSafe,

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.