Trait Canvas

Source
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§

Source

fn id(&self) -> i32

Provided Methods§

Source

fn draw_texture<T: Texture>( &mut self, texture: &T, source: Rect<f32, Pixels>, destination: Rect<f32, Pixels>, )

Source

fn draw_canvas<C: Canvas>( &mut self, canvas: &C, source: Rect<f32, Pixels>, destination: Rect<f32, Pixels>, )

Source

fn resize(&mut self, size: Size2D<u16, Pixels>)

Source

fn clear(&mut self)

Source

fn set_global_alpha(&mut self, alpha: f32)

Source

fn set_global_composite_operation(&mut self, operation: CompositeOperation)

Source

fn size(&self) -> Size2D<u16, Pixels>

Source

fn set_fill_style<S>(&mut self, style: S)
where S: AsRef<str>,

Source

fn set_stroke_style<S>(&mut self, style: S)
where S: AsRef<str>,

Source

fn set_font<S>(&mut self, font: S)
where S: AsRef<str>,

Source

fn set_line_width(&mut self, line_width: Length<f32, Pixels>)

Source

fn fill_text<S>( &mut self, text: S, position: Point2D<f32, Pixels>, max_width: Option<Length<f32, Pixels>>, )
where S: AsRef<str>,

Source

fn stroke_text<S>( &mut self, text: S, position: Point2D<f32, Pixels>, max_width: Option<Length<f32, Pixels>>, )
where S: AsRef<str>,

Source

fn fill_rectangle(&mut self, rectangle: Rect<f32, Pixels>)

Source

fn stroke_rectangle(&mut self, rectangle: Rect<f32, Pixels>)

Source

fn clear_rectangle(&mut self, rectangle: Rect<f32, Pixels>)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<D: Canvas> Canvas for &D

Source§

fn id(&self) -> i32

Source§

impl<D: Canvas> Canvas for &mut D

Source§

fn id(&self) -> i32

Implementors§

Source§

impl Canvas for OffscreenCanvas

Source§

impl Canvas for Screen

Source§

impl<'a, C> Canvas for CanvasState<'a, C>
where C: Canvas + Debug,

Source§

impl<'a, C> Canvas for Path<'a, C>
where C: Canvas + Debug,