pub struct PixelBuffer {
pub width: u32,
pub height: u32,
pub pixels: Vec<u8>,
}Expand description
An RGBA pixel buffer.
Fields§
§width: u32§height: u32§pixels: Vec<u8>Row-major RGBA bytes [r, g, b, a, r, g, b, a, …]
Implementations§
Source§impl PixelBuffer
impl PixelBuffer
Sourcepub fn set_pixel(&mut self, x: u32, y: u32, r: u8, g: u8, b: u8, a: u8)
pub fn set_pixel(&mut self, x: u32, y: u32, r: u8, g: u8, b: u8, a: u8)
Set pixel at (x, y) to RGBA.
Sourcepub fn to_tga_bytes(&self) -> Vec<u8> ⓘ
pub fn to_tga_bytes(&self) -> Vec<u8> ⓘ
Export as a TGA file (simple uncompressed 32-bit RGBA TGA — no external crates needed).
TGA format: 18-byte header + pixel data (top-to-bottom with flip flag).
Auto Trait Implementations§
impl Freeze for PixelBuffer
impl RefUnwindSafe for PixelBuffer
impl Send for PixelBuffer
impl Sync for PixelBuffer
impl Unpin for PixelBuffer
impl UnsafeUnpin 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more