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§
Sourcefn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Sourcefn dyn_clone(&self) -> Box<dyn Scene>
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.
Sourcefn reset(&mut self)
fn reset(&mut self)
Resets the Scene to its initial state.
This scene should be equal to Scene::new after this call.
Sourcefn draw_rect(
&mut self,
brush: &Brush,
transform: Option<Affine>,
stroke: Option<&Stroke>,
rect: &Rect,
)
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.
Sourcefn draw_rounded_rect(
&mut self,
brush: &Brush,
transform: Option<Affine>,
stroke: Option<&Stroke>,
rect: &RoundedRect,
)
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.
Sourcefn draw_circle(
&mut self,
brush: &Brush,
transform: Option<Affine>,
stroke: Option<&Stroke>,
circle: &Circle,
)
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.
Sourcefn draw_circle_segment(
&mut self,
brush: &Brush,
transform: Option<Affine>,
stroke: Option<&Stroke>,
circle_segment: &CircleSegment,
)
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.
Sourcefn draw_ellipse(
&mut self,
brush: &Brush,
transform: Option<Affine>,
stroke: Option<&Stroke>,
ellipse: &Ellipse,
)
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.
Sourcefn draw_cubic_bezier(
&mut self,
brush: &Brush,
transform: Option<Affine>,
stroke: Option<&Stroke>,
cubic_bez: &CubicBez,
)
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.
Sourcefn draw_quadratic_bezier(
&mut self,
brush: &Brush,
transform: Option<Affine>,
stroke: Option<&Stroke>,
quad_bez: &QuadBez,
)
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.
Sourcefn draw_triangle(
&mut self,
brush: &Brush,
transform: Option<Affine>,
stroke: Option<&Stroke>,
triangle: &Triangle,
)
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.
Sourcefn draw_image(
&mut self,
img: &ImageBrush,
transform: Option<Affine>,
position: Vector2<f32>,
)
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).
Sourcefn 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,
)
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.