Scene

Trait Scene 

Source
pub trait Scene: 'static {
Show 16 methods // Required methods fn new() -> Self where Self: Sized; fn as_any(&self) -> &dyn Any; fn as_any_mut(&mut self) -> &mut dyn Any; fn dyn_clone(&self) -> Box<dyn Scene>; fn reset(&mut self); fn append(&mut self, other: &dyn Scene, transform: Option<Affine>); fn draw_rect( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, rect: &Rect, ); fn draw_rounded_rect( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, rect: &RoundedRect, ); fn draw_circle( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, circle: &Circle, ); fn draw_circle_segment( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, circle_segment: &CircleSegment, ); fn draw_ellipse( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, ellipse: &Ellipse, ); fn draw_cubic_bezier( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, cubic_bez: &CubicBez, ); fn draw_quadratic_bezier( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, quad_bez: &QuadBez, ); fn draw_triangle( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, triangle: &Triangle, ); fn draw_image( &mut self, img: &ImageBrush, transform: Option<Affine>, position: Vector2<f32>, ); fn draw_text( &mut self, brush: &Brush, transform: Option<Affine>, position: Vector2<f32>, text: &str, hinting: bool, font: &FontData, size: f32, line_gap: f32, max_width: f32, );
}
Expand description

An interface for drawing vector graphics onto a canvas.

Must be provided by the VectorGraphicsInterface.

Required Methods§

Source

fn new() -> Self
where Self: Sized,

Creates a new empty scene.

Source

fn as_any(&self) -> &dyn Any

Returns this Scene as an Any reference.

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Returns this Scene as a mutable Any reference.

Source

fn dyn_clone(&self) -> Box<dyn Scene>

Clones this Scene and returns it boxed.

Used to keep object safety while allowing the scene to be cloned.

Source

fn reset(&mut self)

Resets the Scene to its initial state.

This scene should be equal to Scene::new after this call.

Source

fn append(&mut self, other: &dyn Scene, transform: Option<Affine>)

Appends the given Scene to this Scene.

Apply an optional transform to the scene.

Source

fn draw_rect( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, rect: &Rect, )

Draws a rectangle onto the Scene with the given brush.

Apply an optional transform to the rectangle.

Optionally, strokes and does not fill the rectangle.

Source

fn draw_rounded_rect( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, rect: &RoundedRect, )

Draws a rounded rectangle onto the Scene with the given brush.

Apply an optional transform to the rectangle.

Optionally, strokes and does not fill the rectangle.

Source

fn draw_circle( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, circle: &Circle, )

Draws a circle onto the Scene with the given brush.

Apply an optional transform to the circle.

Optionally, strokes and does not fill the circle.

Source

fn draw_circle_segment( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, circle_segment: &CircleSegment, )

Draws a circle segment onto the Scene with the given brush.

Apply an optional transform to the circle segment.

Optionally, strokes and does not fill the circle segment.

Source

fn draw_ellipse( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, ellipse: &Ellipse, )

Draws an ellipse onto the Scene with the given brush.

Apply an optional transform to the ellipse.

Optionally, strokes and does not fill the ellipse.

Source

fn draw_cubic_bezier( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, cubic_bez: &CubicBez, )

Draws a cubic bezier onto the Scene with the given brush.

Apply an optional transform to the cubic bezier.

Optionally, strokes and does not fill the cubic bezier.

Source

fn draw_quadratic_bezier( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, quad_bez: &QuadBez, )

Draws a quadratic bezier onto the Scene with the given brush.

Apply an optional transform to the quadratic bezier.

Optionally, strokes and does not fill the quadratic bezier.

Source

fn draw_triangle( &mut self, brush: &Brush, transform: Option<Affine>, stroke: Option<&Stroke>, triangle: &Triangle, )

Draws a triangle onto the Scene with the given brush.

Apply an optional transform to the triangle.

Optionally, strokes and does not fill the triangle.

Source

fn draw_image( &mut self, img: &ImageBrush, transform: Option<Affine>, position: Vector2<f32>, )

Draws an image onto the Scene with the given brush.

Apply an optional transform to the image (after the position is inserted).

Source

fn draw_text( &mut self, brush: &Brush, transform: Option<Affine>, position: Vector2<f32>, text: &str, hinting: bool, font: &FontData, size: f32, line_gap: f32, max_width: f32, )

Draws text onto the Scene with the given brush.

Apply an optional transform to the text (after the position is inserted).

You can also specify hinting, size, and the line gap.

Furthermore, you can choose if the text should be wrapped by passing max_width.

Implementors§