pub struct Canvas {
pub width: usize,
pub height: usize,
pub pixels: Vec<u32>,
}Fields§
§width: usize§height: usize§pixels: Vec<u32>Implementations§
Source§impl Canvas
impl Canvas
pub fn new(width: usize, height: usize, pixels: &[u32]) -> Self
pub fn from_color(width: usize, height: usize, r: u8, g: u8, b: u8) -> Self
pub fn get_pixel(&mut self, x: usize, y: usize) -> u32
pub fn set_pixel(&mut self, x: usize, y: usize, color: u32)
pub fn draw_canvas( &mut self, canvas: &Canvas, x: isize, y: isize, ) -> Result<(), &'static str>
pub fn blit_canvas( &mut self, canvas: &Canvas, x: isize, y: isize, blit_map: &BlitMap, ) -> Result<(), &'static str>
pub fn copy_from_canvas( &mut self, canvas: &Canvas, ) -> Result<(), Box<dyn Error>>
pub fn plot_line(&mut self, point0: Point, point1: Point, color: u32)
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 UnsafeUnpin 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
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