pub struct PixelBuffer {
pub data: Vec<u8>,
pub width: usize,
pub height: usize,
pub byte_size: usize,
}Expand description
Pixel buffer for rendered content
Fields§
§data: Vec<u8>Raw pixel data in BGRA format
width: usizeWidth of the buffer
height: usizeHeight of the buffer
byte_size: usizeTotal byte size (width * height * 4)
Implementations§
Source§impl PixelBuffer
impl PixelBuffer
Sourcepub fn get_pixel(&self, x: usize, y: usize) -> Option<[u8; 4]>
pub fn get_pixel(&self, x: usize, y: usize) -> Option<[u8; 4]>
Get a pixel at the specified coordinates
Sourcepub fn set_pixel(&mut self, x: usize, y: usize, bgra: [u8; 4]) -> bool
pub fn set_pixel(&mut self, x: usize, y: usize, bgra: [u8; 4]) -> bool
Set a pixel at the specified coordinates
Sourcepub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Get the raw data as a mutable slice
Trait Implementations§
Source§impl Clone for PixelBuffer
impl Clone for PixelBuffer
Source§fn clone(&self) -> PixelBuffer
fn clone(&self) -> PixelBuffer
Returns a duplicate of the value. Read more
1.0.0 · 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 PixelBuffer
impl RefUnwindSafe for PixelBuffer
impl Send for PixelBuffer
impl Sync for PixelBuffer
impl Unpin for PixelBuffer
impl UnwindSafe for PixelBuffer
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