graphics_rs/traits/
canvas.rs

1use super::shape::Shape;
2use crate::color::Color;
3
4pub trait Canvas {
5    fn draw_shape(&mut self, shape: &mut impl Shape);
6    fn change_color(&mut self, color: Color);
7    fn clamp_row(&self, row: i64) -> i64;
8    fn clamp_col(&self, col: i64) -> i64;
9    fn set_pixel(&mut self, row: usize, col: usize);
10    fn set_pixel_color(&mut self, row: usize, col: usize, color: Color);
11    fn color_at(&self, index: usize) -> Color;
12    fn width(&self) -> usize;
13    fn height(&self) -> usize;
14    fn fits_inside(&self, row: i64, col: i64) -> bool;
15    fn fill(&mut self);
16    fn antialiasing(&self) -> bool;
17    fn resolution(&self) -> usize;
18    fn color(&self) -> Color;
19    fn buffer_mut_slice(&mut self) -> &mut [Color];
20}