[−][src]Trait pushrod::render::canvas_helper::CanvasHelper
This trait is used in conjunction with Widget
s or anything else that draws to a Canvas
object.
It provides convenience methods to provide drawing functions common to Widget
s. All points and
dimensions are relative to the position of the Widget
, so no translation is necessary.
To implement this trait in your Widget
, all you have to do is:
ⓘThis example is not tested
impl CanvasHelper for (myWidget) { }
Provided methods
fn draw_point(&mut self, c: &mut Canvas<Window>, x: i32, y: i32)
Draws a point in the Canvas
.
fn draw_bounding_box(&mut self, c: &mut Canvas<Window>)
Draws a box around the bounding area of the Widget
.
fn get_rect_dest(&mut self) -> Rect
Returns a Rect
destination object