pub struct ImageAsset {
pub width: u32,
pub height: u32,
pub pixels: Vec<u8>,
pub format: PixelFormat,
}Expand description
Image asset (CPU-side pixel data).
Fields§
§width: u32Pixel width.
height: u32Pixel height.
pixels: Vec<u8>Raw RGBA pixel data.
format: PixelFormatFormat.
Implementations§
Source§impl ImageAsset
impl ImageAsset
Sourcepub fn get_pixel(&self, x: u32, y: u32) -> (u8, u8, u8, u8)
pub fn get_pixel(&self, x: u32, y: u32) -> (u8, u8, u8, u8)
Get a pixel at (x, y). Returns (r, g, b, a) as u8.
Sourcepub fn sub_image(&self, x: u32, y: u32, w: u32, h: u32) -> ImageAsset
pub fn sub_image(&self, x: u32, y: u32, w: u32, h: u32) -> ImageAsset
Create a sub-image (region copy).
Sourcepub fn flip_horizontal(&mut self)
pub fn flip_horizontal(&mut self)
Flip the image horizontally.
Sourcepub fn flip_vertical(&mut self)
pub fn flip_vertical(&mut self)
Flip the image vertically.
Trait Implementations§
Source§impl Clone for ImageAsset
impl Clone for ImageAsset
Source§fn clone(&self) -> ImageAsset
fn clone(&self) -> ImageAsset
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ImageAsset
impl RefUnwindSafe for ImageAsset
impl Send for ImageAsset
impl Sync for ImageAsset
impl Unpin for ImageAsset
impl UnsafeUnpin for ImageAsset
impl UnwindSafe for ImageAsset
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