pub struct Canvas {
pub pixels: Vec<u8>,
pub size: Vector2I,
pub stride: usize,
pub format: Format,
}
Expand description
An in-memory bitmap surface for glyph rasterization.
Fields§
§pixels: Vec<u8>
The raw pixel data.
size: Vector2I
The size of the buffer, in pixels.
stride: usize
The number of bytes between successive rows.
format: Format
The image format of the canvas.
Implementations§
source§impl Canvas
impl Canvas
sourcepub fn new(size: Vector2I, format: Format) -> Canvas
pub fn new(size: Vector2I, format: Format) -> Canvas
Creates a new blank canvas with the given pixel size and format.
Stride is automatically calculated from width.
The canvas is initialized with transparent black (all values 0).
sourcepub fn with_stride(size: Vector2I, stride: usize, format: Format) -> Canvas
pub fn with_stride(size: Vector2I, stride: usize, format: Format) -> Canvas
Creates a new blank canvas with the given pixel size, stride (number of bytes between successive rows), and format.
The canvas is initialized with transparent black (all values 0).
pub(crate) fn blit_from_canvas(&mut self, src: &Canvas)
pub(crate) fn blit_from( &mut self, dst_point: Vector2I, src_bytes: &[u8], src_size: Vector2I, src_stride: usize, src_format: Format, )
pub(crate) fn blit_from_bitmap_1bpp( &mut self, dst_point: Vector2I, src_bytes: &[u8], src_size: Vector2I, src_stride: usize, )
fn blit_from_with<B: Blit>( &mut self, rect: RectI, src_bytes: &[u8], src_stride: usize, src_format: Format, )
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Canvas
impl RefUnwindSafe for Canvas
impl Send for Canvas
impl Sync for Canvas
impl Unpin for Canvas
impl UnwindSafe for Canvas
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