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>
impl<S: Source> RawDecoder<S>
Sourcepub fn new(layout: RawFormat, source: S) -> Result<Self>
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.
Trait Implementations§
Source§impl<S: Source + Debug> Decoder for RawDecoder<S>
impl<S: Source + Debug> Decoder for RawDecoder<S>
Source§fn descriptor(&self) -> ImageDescriptor
fn descriptor(&self) -> ImageDescriptor
The shape of the image, known after the header is parsed.
Source§fn capability(&self) -> DecodeCapability
fn capability(&self) -> DecodeCapability
What this decoder can produce without a full decode.
Source§fn read_row(&mut self, out: &mut [u8]) -> Result<()>
fn read_row(&mut self, out: &mut [u8]) -> Result<()>
Decode the next row, top to bottom, into
out. Read moreSource§fn orientation(&self) -> Orientation
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>
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]>
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>
fn read_region( &mut self, region: Region, out: &mut TileMut<'_>, ) -> Result<(), PixelsError>
Decode an arbitrary region into
out. Read moreSource§fn reduced_descriptor(&self, target: (u32, u32)) -> Option<ImageDescriptor>
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 moreSource§fn reduce_to(&mut self, descriptor: ImageDescriptor) -> Result<(), PixelsError>
fn reduce_to(&mut self, descriptor: ImageDescriptor) -> Result<(), PixelsError>
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> 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