pub struct ImageData<'a> { /* private fields */ }Expand description
image data
Implementations§
Source§impl ImageData<'_>
impl ImageData<'_>
Sourcepub fn pixels(&self) -> &[u8]
pub fn pixels(&self) -> &[u8]
get pixel values encoded as bytes.
this is guaranteed to be a prefix of the buffer passed to decode_png.
Sourcepub fn palette(&self, index: u8) -> [u8; 4]
pub fn palette(&self, index: u8) -> [u8; 4]
get color in palette at index.
returns [0, 0, 0, 255] if index is out of range.
Sourcepub fn color_type(&self) -> ColorType
pub fn color_type(&self) -> ColorType
number and type of color channels
Sourcepub fn bytes_per_row(&self) -> usize
pub fn bytes_per_row(&self) -> usize
number of bytes in a single row of pixels
Sourcepub fn convert_to_rgba8bpc(&mut self) -> Result<()>
pub fn convert_to_rgba8bpc(&mut self) -> Result<()>
convert self to 8-bits-per-channel RGBA
note: this function can fail with Error::BufferTooSmall
if the buffer you allocated is too small!
make sure to use ImageHeader::required_bytes_rgba8bpc for this.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ImageData<'a>
impl<'a> RefUnwindSafe for ImageData<'a>
impl<'a> Send for ImageData<'a>
impl<'a> Sync for ImageData<'a>
impl<'a> Unpin for ImageData<'a>
impl<'a> !UnwindSafe for ImageData<'a>
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