pub struct RasterBuf {
pub width: u32,
pub height: u32,
pub pixels: Vec<u8>,
}Expand description
RGBA8 raster, sRGB color space, premultiplied alpha. Layout is
row-major, four bytes per pixel [R, G, B, A].
Fields§
§width: u32§height: u32§pixels: Vec<u8>Implementations§
Source§impl RasterBuf
impl RasterBuf
pub fn new(width: u32, height: u32) -> Self
pub fn filled(width: u32, height: u32, rgba: [u8; 4]) -> Self
Sourcepub fn is_blank(&self) -> bool
pub fn is_blank(&self) -> bool
Whether every byte is zero — i.e. fully transparent everywhere.
For premultiplied RGBA this means no coverage and no color at all
(a valid premultiplied pixel with a == 0 also has rgb == 0).
Scans in u128-wide chunks, so a canvas-sized buffer costs only
tens of microseconds.
pub fn pixel(&self, x: u32, y: u32) -> [u8; 4]
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RasterBuf
impl RefUnwindSafe for RasterBuf
impl Send for RasterBuf
impl Sync for RasterBuf
impl Unpin for RasterBuf
impl UnsafeUnpin for RasterBuf
impl UnwindSafe for RasterBuf
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