pub struct Image { /* private fields */ }Expand description
An image loaded from a file.
Implementations§
Source§impl Image
impl Image
pub fn width(&self) -> u32
pub fn height(&self) -> u32
Sourcepub fn data(&self) -> &[u8] ⓘ
pub fn data(&self) -> &[u8] ⓘ
Gets the image data as a slice of bytes, each byte representing a pixel indexed by the image’s palette.
Sourcepub fn data_mut(&mut self) -> &mut [u8] ⓘ
pub fn data_mut(&mut self) -> &mut [u8] ⓘ
Gets the image data as a mutable slice of bytes, each byte representing a pixel indexed by the image’s palette.
Sourcepub fn palette_count(&self) -> u32
pub fn palette_count(&self) -> u32
Gets the number of pixel colors in the palette.
The full size of the palette is palette_count * 3 bytes.
Sourcepub fn palette(&self) -> &[u8] ⓘ
pub fn palette(&self) -> &[u8] ⓘ
Gets the image’s color palette as a slice of bytes, in RGB (8 bits per channel).
Sourcepub fn palette_mut(&mut self) -> &mut [u8] ⓘ
pub fn palette_mut(&mut self) -> &mut [u8] ⓘ
Gets the image’s color palette as a mutable slice of bytes, in RGB (8 bits per channel).
Sourcepub fn raw_palette(&self) -> &[u8; 768]
pub fn raw_palette(&self) -> &[u8; 768]
Gets the image’s color palette as a reference to the underlying array, in RGB (8 bits per channel).
The maximum expected size of any palette is 768 bytes
(256 colors * 3 bytes per color).
Note that the real palette used might be smaller than
the full size of the array,
see palette for an accurate slice.