pub trait Canvas {
Show 17 methods
// Required method
fn id(&self) -> i32;
// Provided methods
fn draw_texture<T: Texture>(
&mut self,
texture: &T,
source: Rect<f32, Pixels>,
destination: Rect<f32, Pixels>
) { ... }
fn draw_canvas<C: Canvas>(
&mut self,
canvas: &C,
source: Rect<f32, Pixels>,
destination: Rect<f32, Pixels>
) { ... }
fn resize(&mut self, size: Size2D<u16, Pixels>) { ... }
fn clear(&mut self) { ... }
fn set_global_alpha(&mut self, alpha: f32) { ... }
fn set_global_composite_operation(&mut self, operation: CompositeOperation) { ... }
fn size(&self) -> Size2D<u16, Pixels> { ... }
fn set_fill_style<S>(&mut self, style: S)
where S: AsRef<str> { ... }
fn set_stroke_style<S>(&mut self, style: S)
where S: AsRef<str> { ... }
fn set_font<S>(&mut self, font: S)
where S: AsRef<str> { ... }
fn set_line_width(&mut self, line_width: Length<f32, Pixels>) { ... }
fn fill_text<S>(
&mut self,
text: S,
position: Point2D<f32, Pixels>,
max_width: Option<Length<f32, Pixels>>
)
where S: AsRef<str> { ... }
fn stroke_text<S>(
&mut self,
text: S,
position: Point2D<f32, Pixels>,
max_width: Option<Length<f32, Pixels>>
)
where S: AsRef<str> { ... }
fn fill_rectangle(&mut self, rectangle: Rect<f32, Pixels>) { ... }
fn stroke_rectangle(&mut self, rectangle: Rect<f32, Pixels>) { ... }
fn clear_rectangle(&mut self, rectangle: Rect<f32, Pixels>) { ... }
}
Expand description
A draw destination trait, used for wrapping a canvas in something like a camera, or even a split screen, to abstract drawing.
Required Methods§
Provided Methods§
fn draw_texture<T: Texture>( &mut self, texture: &T, source: Rect<f32, Pixels>, destination: Rect<f32, Pixels> )
fn draw_canvas<C: Canvas>( &mut self, canvas: &C, source: Rect<f32, Pixels>, destination: Rect<f32, Pixels> )
fn resize(&mut self, size: Size2D<u16, Pixels>)
fn clear(&mut self)
fn set_global_alpha(&mut self, alpha: f32)
fn set_global_composite_operation(&mut self, operation: CompositeOperation)
fn size(&self) -> Size2D<u16, Pixels>
fn set_fill_style<S>(&mut self, style: S)
fn set_stroke_style<S>(&mut self, style: S)
fn set_font<S>(&mut self, font: S)
fn set_line_width(&mut self, line_width: Length<f32, Pixels>)
fn fill_text<S>( &mut self, text: S, position: Point2D<f32, Pixels>, max_width: Option<Length<f32, Pixels>> )
fn stroke_text<S>( &mut self, text: S, position: Point2D<f32, Pixels>, max_width: Option<Length<f32, Pixels>> )
fn fill_rectangle(&mut self, rectangle: Rect<f32, Pixels>)
fn stroke_rectangle(&mut self, rectangle: Rect<f32, Pixels>)
fn clear_rectangle(&mut self, rectangle: Rect<f32, Pixels>)
Object Safety§
This trait is not object safe.