Graphics

Struct Graphics 

Source
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>

Source

pub fn new(x: usize, y: usize, w: usize, h: usize) -> Self

New creates a new graphcs context with the provided offsets and limits

Source

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

Source

pub fn get_bounds(&mut self) -> Rect

Source

pub fn set_bounds(&mut self, bounds: &Rect)

Set new bounds for rendering This will offset and limit rendering by the provided values.

Source

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

Source

pub fn draw_rect(&self, b: &mut dyn Buff<Pixel>, r: Rect, p: &Pixel)

Draws a rectange with the provided pixel style

Source

pub fn fill_rect(&self, b: &mut dyn Buff<Pixel>, r: Rect, p: &Pixel)

Draws a rectangle with the provided pixel style

Source

pub fn draw_polyline( &self, b: &mut dyn Buff<Pixel>, points: &[Point], p: &Pixel, )

Draws a polyline connecting a list of points

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.