Skip to main content

RawDecoder

Struct RawDecoder 

Source
pub struct RawDecoder<S: Source> { /* private fields */ }
Expand description

Decodes a raw pixel stream, one row per call.

Implementations§

Source§

impl<S: Source> RawDecoder<S>

Source

pub fn new(layout: RawFormat, source: S) -> Result<Self>

Wrap source as a decoder for a stream laid out as layout.

No pixel bytes are read here: construction is the (empty) header parse, so laziness holds and the descriptor is available immediately.

§Errors

Returns PixelsError::InvalidArgument if the layout’s byte length overflows usize on this platform.

Source

pub const fn layout(&self) -> RawFormat

The layout this decoder was constructed with.

Source

pub const fn rows_read(&self) -> u32

How many rows have been decoded so far.

Trait Implementations§

Source§

impl<S: Debug + Source> Debug for RawDecoder<S>

Source§

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

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

impl<S: Source + Debug> Decoder for RawDecoder<S>

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<()>

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

fn orientation(&self) -> Orientation

How the stored image must be turned to display upright, as its metadata declares. Read more
Source§

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

The source’s animation, if it has more than one frame. Read more
Source§

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

The embedded ICC colour profile, if the file carries one. 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 RawDecoder<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for RawDecoder<S>
where S: RefUnwindSafe,

§

impl<S> Send for RawDecoder<S>

§

impl<S> Sync for RawDecoder<S>
where S: Sync,

§

impl<S> Unpin for RawDecoder<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for RawDecoder<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for RawDecoder<S>
where 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.