pub struct Buffer {
pub pixels: Vec<Vec<Color>>,
pub width: usize,
pub height: usize,
}Fields§
§pixels: Vec<Vec<Color>>§width: usize§height: usizeImplementations§
Source§impl Buffer
impl Buffer
pub fn new(width: usize, height: usize) -> Buffer
pub fn get_pixel(&self, x: usize, y: usize) -> Color
pub fn blit_pixel(&mut self, x: usize, y: usize, color: Color)
pub fn set_pixel(&mut self, x: usize, y: usize, color: Color)
pub fn save(&self, file: &str) -> Result<(), ImageError>
pub fn load(file: &str) -> Result<Buffer, ImageError>
Source§impl Buffer
impl Buffer
pub fn fill(&mut self, color: Color) -> &mut Self
pub fn draw_circle_line( &mut self, x: i32, y: i32, r: i32, width: i32, color: Color, ) -> &mut Self
pub fn draw_circle(&mut self, x: i32, y: i32, r: i32, color: Color) -> &mut Self
pub fn draw_ellipse( &mut self, x: i64, y: i64, a: i64, b: i64, r: i64, color: Color, ) -> &mut Self
pub fn draw_rect( &mut self, x: i32, y: i32, w: i32, h: i32, color: Color, ) -> &mut Self
pub fn draw_rect_line( &mut self, x: i32, y: i32, w: i32, h: i32, width: i32, color: Color, ) -> &mut Self
pub fn draw_triangle( &mut self, x1: i32, y1: i32, x2: i32, y2: i32, x3: i32, y3: i32, color: Color, ) -> &mut Self
pub fn draw_line( &mut self, x1: i32, y1: i32, x2: i32, y2: i32, width: i32, color: Color, ) -> &mut Self
Trait Implementations§
impl StructuralPartialEq for Buffer
Auto Trait Implementations§
impl Freeze for Buffer
impl RefUnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl UnwindSafe for Buffer
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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