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 { ... }
}

Required Associated Types§

Required Methods§

Source

fn from_layer( context: Option<&Self::DeviceContextType>, layer: &Self::LayerType, ) -> Result<Self, GraphicsError>
where Self: Sized,

Source

fn from_window( context: Option<&Self::DeviceContextType>, window: &Window, ) -> Result<Self, GraphicsError>
where Self: Sized,

Source

fn device_context(&self) -> Option<&Self::DeviceContextType>

Source

fn size(&self) -> FSize

Source

fn pixel_size(&self) -> ISize

Source

fn save(&mut self) -> bool

Source

fn restore(&mut self) -> bool

Source

fn begin_draw(&mut self)

Source

fn end_draw(&mut self)

Source

fn get_opacity(&self) -> Float

Source

fn set_opacity(&mut self, opacity: Float)

Source

fn get_blend_mode(&self) -> BlendMode

Source

fn set_blend_mode(&mut self, mode: BlendMode)

Source

fn get_draw_mode(&self) -> DrawMode

Source

fn set_draw_mode(&mut self, mode: DrawMode)

Source

fn get_line_dash(&self) -> (Option<Vec<Float>>, Float)

Source

fn set_line_dash(&mut self, dashes: &[Float], offset: Float)

Source

fn get_matrix(&self) -> Self::MatrixType

Source

fn set_matrix(&mut self, matrix: &Self::MatrixType)

Source

fn concat_matrix(&mut self, matrix: &Self::MatrixType)

Source

fn get_miter_limit(&self) -> Float

Source

fn set_miter_limit(&mut self, miter_limit: Float)

Source

fn get_smooth(&self) -> bool

Source

fn set_smooth(&mut self, smooth: bool)

Source

fn get_stroke_cap(&self) -> Cap

Source

fn set_stroke_cap(&mut self, cap: Cap)

Source

fn get_stroke_join(&self) -> Join

Source

fn set_stroke_join(&mut self, join: Join)

Source

fn get_stroke_width(&self) -> Float

Source

fn set_stroke_width(&mut self, width: Float)

Source

fn set_brush(&mut self, brush: &Self::BrushType)

Source

fn get_font_family(&self) -> &str

Source

fn set_font_family(&mut self, family: &str)

Source

fn get_font_size(&self) -> Float

Source

fn set_font_size(&mut self, size: Float)

Source

fn get_font_style(&self) -> FontStyle

Source

fn set_font_style(&mut self, style: FontStyle)

Source

fn get_font_weight(&self) -> FontWeight

Source

fn set_font_weight(&mut self, weight: FontWeight)

Source

fn get_text_alignment(&self) -> TextAlignment

Source

fn set_text_alignment(&mut self, alignment: TextAlignment)

Source

fn get_text_color(&self) -> Color

Source

fn set_text_color(&mut self, color: Color)

Source

fn rotate(&mut self, angle: Float)

Source

fn scale(&mut self, x: Float, y: Float)

Source

fn translate(&mut self, x: Float, y: Float)

Source

fn clear(&mut self, color: Color)

Source

fn clip_to_rect(&mut self, rect: FRect)

Source

fn clip_to_path(&mut self, path: &Self::PathType)

Source

fn draw_path(&mut self, path: &Self::PathType) -> bool

Source

fn draw_bitmap( &mut self, bitmap: &Self::BitmapType, source_rect: Option<FRect>, dest_rect: FRect, ) -> bool

Source

fn draw_layer(&mut self, layer: &Self::LayerType, dest_rect: FRect) -> bool

Source

fn draw_text(&mut self, text: &str, rect: FRect) -> bool

Source

fn draw_text_at(&mut self, text: &str, x: Float, y: Float) -> bool

Source

fn fill_rect( &mut self, x: Float, y: Float, width: Float, height: Float, mask: Option<&Self::BitmapType>, ) -> bool

Provided Methods§

Source

fn bounds(&self) -> FRect

Source

fn draw_line(&mut self, x1: Float, y1: Float, x2: Float, y2: Float) -> bool

Source

fn draw_rect(&mut self, x: Float, y: Float, width: Float, height: Float) -> bool

Source

fn draw_rounded_rect( &mut self, x: Float, y: Float, width: Float, height: Float, radius: Float, ) -> bool

Source

fn draw_circle(&mut self, x: Float, y: Float, radius: Float) -> bool

Source

fn draw_ellipse( &mut self, x: Float, y: Float, width: Float, height: Float, ) -> bool

Source

fn map_rect(&self, rect: FRect) -> FRect

Implementors§