pub struct RawImage<'a, S: Sample> { /* private fields */ }Expand description
A borrowed interleaved image whose layout is known only at runtime.
The counterpart of ImageRef for a decoder that has just produced native samples and does not
yet have them in a branded buffer: the layout travels as a PixelFormat tag instead of a
Pixel brand. Validated on construction exactly as ImageRef::new is, so the conversion
engine can trust the length and the sample width.
Implementations§
Source§impl<'a, S: Sample> RawImage<'a, S>
impl<'a, S: Sample> RawImage<'a, S>
Sourcepub fn new(
samples: &'a [S],
format: PixelFormat,
dims: Dimensions,
) -> Result<Self>
pub fn new( samples: &'a [S], format: PixelFormat, dims: Dimensions, ) -> Result<Self>
Describes samples as an image of dims in layout format.
§Errors
Returns Error::InvalidInput if S is not format’s sample width, if dims is
zero-sized or overflows usize, or if samples.len() is not
width * height * format.channels().
Sourcepub fn as_samples(self) -> &'a [S]
pub fn as_samples(self) -> &'a [S]
The raw interleaved samples, row-major.
Sourcepub fn format(self) -> PixelFormat
pub fn format(self) -> PixelFormat
The runtime layout tag.
Sourcepub fn dimensions(self) -> Dimensions
pub fn dimensions(self) -> Dimensions
The image dimensions.
Trait Implementations§
impl<'a, S: Copy + Sample> Copy for RawImage<'a, S>
Auto Trait Implementations§
impl<'a, S> Freeze for RawImage<'a, S>
impl<'a, S> RefUnwindSafe for RawImage<'a, S>where
&'a [S]: RefUnwindSafe,
impl<'a, S> Send for RawImage<'a, S>
impl<'a, S> Sync for RawImage<'a, S>
impl<'a, S> Unpin for RawImage<'a, S>
impl<'a, S> UnsafeUnpin for RawImage<'a, S>where
&'a [S]: UnsafeUnpin,
impl<'a, S> UnwindSafe for RawImage<'a, S>where
&'a [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