Trait CanvasBackend
Source pub trait CanvasBackend {
type DeviceContextType: DeviceContextBackend;
type BitmapType: BitmapBackend;
type BrushType: BrushBackend;
type LayerType: LayerBackend;
type MatrixType: MatrixBackend;
type PathType: PathBackend;
Show 62 methods
// Required methods
fn from_layer(
context: Option<&Self::DeviceContextType>,
layer: &Self::LayerType,
) -> Result<Self, GraphicsError>
where Self: Sized;
fn from_window(
context: Option<&Self::DeviceContextType>,
window: &Window,
) -> Result<Self, GraphicsError>
where Self: Sized;
fn device_context(&self) -> Option<&Self::DeviceContextType>;
fn size(&self) -> FSize;
fn pixel_size(&self) -> ISize;
fn save(&mut self) -> bool;
fn restore(&mut self) -> bool;
fn begin_draw(&mut self);
fn end_draw(&mut self);
fn get_opacity(&self) -> Float;
fn set_opacity(&mut self, opacity: Float);
fn get_blend_mode(&self) -> BlendMode;
fn set_blend_mode(&mut self, mode: BlendMode);
fn get_draw_mode(&self) -> DrawMode;
fn set_draw_mode(&mut self, mode: DrawMode);
fn get_line_dash(&self) -> (Option<Vec<Float>>, Float);
fn set_line_dash(&mut self, dashes: &[Float], offset: Float);
fn get_matrix(&self) -> Self::MatrixType;
fn set_matrix(&mut self, matrix: &Self::MatrixType);
fn concat_matrix(&mut self, matrix: &Self::MatrixType);
fn get_miter_limit(&self) -> Float;
fn set_miter_limit(&mut self, miter_limit: Float);
fn get_smooth(&self) -> bool;
fn set_smooth(&mut self, smooth: bool);
fn get_stroke_cap(&self) -> Cap;
fn set_stroke_cap(&mut self, cap: Cap);
fn get_stroke_join(&self) -> Join;
fn set_stroke_join(&mut self, join: Join);
fn get_stroke_width(&self) -> Float;
fn set_stroke_width(&mut self, width: Float);
fn set_brush(&mut self, brush: &Self::BrushType);
fn get_font_family(&self) -> &str;
fn set_font_family(&mut self, family: &str);
fn get_font_size(&self) -> Float;
fn set_font_size(&mut self, size: Float);
fn get_font_style(&self) -> FontStyle;
fn set_font_style(&mut self, style: FontStyle);
fn get_font_weight(&self) -> FontWeight;
fn set_font_weight(&mut self, weight: FontWeight);
fn get_text_alignment(&self) -> TextAlignment;
fn set_text_alignment(&mut self, alignment: TextAlignment);
fn get_text_color(&self) -> Color;
fn set_text_color(&mut self, color: Color);
fn rotate(&mut self, angle: Float);
fn scale(&mut self, x: Float, y: Float);
fn translate(&mut self, x: Float, y: Float);
fn clear(&mut self, color: Color);
fn clip_to_rect(&mut self, rect: FRect);
fn clip_to_path(&mut self, path: &Self::PathType);
fn draw_path(&mut self, path: &Self::PathType) -> bool;
fn draw_bitmap(
&mut self,
bitmap: &Self::BitmapType,
source_rect: Option<FRect>,
dest_rect: FRect,
) -> bool;
fn draw_layer(&mut self, layer: &Self::LayerType, dest_rect: FRect) -> bool;
fn draw_text(&mut self, text: &str, rect: FRect) -> bool;
fn draw_text_at(&mut self, text: &str, x: Float, y: Float) -> bool;
fn fill_rect(
&mut self,
x: Float,
y: Float,
width: Float,
height: Float,
mask: Option<&Self::BitmapType>,
) -> bool;
// Provided methods
fn bounds(&self) -> FRect { ... }
fn draw_line(&mut self, x1: Float, y1: Float, x2: Float, y2: Float) -> bool { ... }
fn draw_rect(
&mut self,
x: Float,
y: Float,
width: Float,
height: Float,
) -> bool { ... }
fn draw_rounded_rect(
&mut self,
x: Float,
y: Float,
width: Float,
height: Float,
radius: Float,
) -> bool { ... }
fn draw_circle(&mut self, x: Float, y: Float, radius: Float) -> bool { ... }
fn draw_ellipse(
&mut self,
x: Float,
y: Float,
width: Float,
height: Float,
) -> bool { ... }
fn map_rect(&self, rect: FRect) -> FRect { ... }
}