pub struct RgbaImage {
pub width: u32,
pub height: u32,
pub pixels: Vec<u8>,
}Expand description
RGBA, 8 bits per channel, straight (not premultiplied) alpha.
Fields§
§width: u32Width in pixels.
height: u32Height in pixels.
pixels: Vec<u8>width * height * 4 bytes, rows top to bottom, R G B A.
Implementations§
Source§impl RgbaImage
impl RgbaImage
Sourcepub fn pixel(&self, x: u32, y: u32) -> [u8; 4]
pub fn pixel(&self, x: u32, y: u32) -> [u8; 4]
The RGBA pixel at (x, y). Panics outside the image.
Sourcepub fn set_pixel(&mut self, x: u32, y: u32, pixel: [u8; 4])
pub fn set_pixel(&mut self, x: u32, y: u32, pixel: [u8; 4])
Sets the RGBA pixel at (x, y). Panics outside the image.
Sourcepub fn alpha_bbox(&self) -> Option<(u32, u32, u32, u32)>
pub fn alpha_bbox(&self) -> Option<(u32, u32, u32, u32)>
Bounding box (x0, y0, x1, y1, exclusive ends) of the pixels with alpha.
Sourcepub fn resize_area(&self, width: u32, height: u32) -> RgbaImage
pub fn resize_area(&self, width: u32, height: u32) -> RgbaImage
Shrink to width×height with an area (box) filter on premultiplied colour.
Sourcepub fn halve(&self) -> RgbaImage
pub fn halve(&self) -> RgbaImage
Halve with a 2×2 box on premultiplied colour (width and height rounded down).
Sourcepub fn paste(&mut self, other: &RgbaImage, x: i64, y: i64)
pub fn paste(&mut self, other: &RgbaImage, x: i64, y: i64)
Copy other onto self with its top-left at (x, y), replacing pixels
(no blending); parts outside are dropped.
Trait Implementations§
impl Eq for RgbaImage
impl StructuralPartialEq for RgbaImage
Auto Trait Implementations§
impl Freeze for RgbaImage
impl RefUnwindSafe for RgbaImage
impl Send for RgbaImage
impl Sync for RgbaImage
impl Unpin for RgbaImage
impl UnsafeUnpin for RgbaImage
impl UnwindSafe for RgbaImage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.