pub struct Graphics<Pixel> { /* private fields */ }Expand description
Graphics context used for rendering components This includes offsets and dimensions to shift rendering scopes
Implementations§
Source§impl<Pixel> Graphics<Pixel>
impl<Pixel> Graphics<Pixel>
Sourcepub fn new(x: usize, y: usize, w: usize, h: usize) -> Self
pub fn new(x: usize, y: usize, w: usize, h: usize) -> Self
New creates a new graphcs context with the provided offsets and limits
Sourcepub fn set(&self, b: &mut dyn Buff<Pixel>, x: usize, y: usize, p: &Pixel)
pub fn set(&self, b: &mut dyn Buff<Pixel>, x: usize, y: usize, p: &Pixel)
Set wraps a buffer in a graphics context to shift rendering functions
pub fn get_bounds(&mut self) -> Rect
Sourcepub fn set_bounds(&mut self, bounds: &Rect)
pub fn set_bounds(&mut self, bounds: &Rect)
Set new bounds for rendering This will offset and limit rendering by the provided values.
Sourcepub fn draw_line(
&self,
buf: &mut dyn Buff<Pixel>,
p1: Point,
p2: Point,
p: &Pixel,
)
pub fn draw_line( &self, buf: &mut dyn Buff<Pixel>, p1: Point, p2: Point, p: &Pixel, )
Draws a line between two points with the provided pixel style
Sourcepub fn draw_rect(&self, b: &mut dyn Buff<Pixel>, r: Rect, p: &Pixel)
pub fn draw_rect(&self, b: &mut dyn Buff<Pixel>, r: Rect, p: &Pixel)
Draws a rectange with the provided pixel style
Sourcepub fn fill_rect(&self, b: &mut dyn Buff<Pixel>, r: Rect, p: &Pixel)
pub fn fill_rect(&self, b: &mut dyn Buff<Pixel>, r: Rect, p: &Pixel)
Draws a rectangle with the provided pixel style
Sourcepub fn draw_polyline(
&self,
b: &mut dyn Buff<Pixel>,
points: &[Point],
p: &Pixel,
)
pub fn draw_polyline( &self, b: &mut dyn Buff<Pixel>, points: &[Point], p: &Pixel, )
Draws a polyline connecting a list of points
Sourcepub fn draw_ellipse(&self, buf: &mut dyn Buff<Pixel>, r: Rect, p: &Pixel)
pub fn draw_ellipse(&self, buf: &mut dyn Buff<Pixel>, r: Rect, p: &Pixel)
Draws an ellipse to fill the provided rectangle
Auto Trait Implementations§
impl<Pixel> Freeze for Graphics<Pixel>
impl<Pixel> RefUnwindSafe for Graphics<Pixel>where
Pixel: RefUnwindSafe,
impl<Pixel> Send for Graphics<Pixel>where
Pixel: Send,
impl<Pixel> Sync for Graphics<Pixel>where
Pixel: Sync,
impl<Pixel> Unpin for Graphics<Pixel>where
Pixel: Unpin,
impl<Pixel> UnwindSafe for Graphics<Pixel>where
Pixel: UnwindSafe,
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