logo
pub trait Drawable {
    fn draw(&self, canvas: &mut Canvas, param: impl Into<DrawParam>);
    fn dimensions(&self, gfx: &impl Has<GraphicsContext>) -> Option<Rect>;
}
Expand description

All types that can be drawn onto a canvas implement the Drawable trait.

Required Methods

Draws the drawable onto the canvas.

Returns a bounding box in the form of a Rect.

It returns Option because some Drawables may have no bounding box, namely InstanceArray (as there is no true bounds for the instances given the instanced mesh can differ).

Implementors