pub enum CanvasCommand {
FillRect {
bounds: Rect,
color: Color,
},
StrokeRect {
bounds: Rect,
color: Color,
line_width: f32,
},
ClearRect {
bounds: Rect,
},
DrawLine {
p0: (f32, f32),
p1: (f32, f32),
color: Color,
line_width: f32,
},
DrawCircle {
center: (f32, f32),
radius: f32,
fill_color: Option<Color>,
stroke_color: Option<Color>,
line_width: f32,
},
DrawPath {
verbs: Vec<CanvasPathVerb>,
fill_color: Option<Color>,
stroke_color: Option<Color>,
line_width: f32,
},
Save,
Restore,
SetLineDash {
segments: Vec<f32>,
offset: f32,
},
ClipPath {
verbs: Vec<CanvasPathVerb>,
},
FillText {
text: String,
x: f32,
y: f32,
color: Color,
font: String,
font_size: f32,
font_family: String,
font_weight: u16,
italic: bool,
text_align: CanvasTextAlign,
text_baseline: CanvasTextBaseline,
max_width: Option<f32>,
},
StrokeText {},
}Expand description
Renderable 2D canvas drawing instruction.
Variants§
FillRect
StrokeRect
ClearRect
DrawLine
DrawCircle
Fields
DrawPath
Fields
§
verbs: Vec<CanvasPathVerb>Save
Pushes the active backend graphics state (clip region and dash state).
Restore
Pops the most recently pushed backend graphics state.
SetLineDash
Sets the stroke dash pattern (empty clears dashing) and phase offset.
ClipPath
Intersects the active clip region with the given path until the matching Restore.
Fields
§
verbs: Vec<CanvasPathVerb>FillText
Renders filled text at (x, y) in transformed canvas coordinates.
StrokeText
Renders outlined/stroked text at (x, y) in transformed canvas coordinates.
Trait Implementations§
Source§impl Clone for CanvasCommand
impl Clone for CanvasCommand
Source§impl Debug for CanvasCommand
impl Debug for CanvasCommand
Source§impl PartialEq for CanvasCommand
impl PartialEq for CanvasCommand
impl StructuralPartialEq for CanvasCommand
Auto Trait Implementations§
impl Forget for CanvasCommand
impl Freeze for CanvasCommand
impl Move for CanvasCommand
impl RefUnwindSafe for CanvasCommand
impl Send for CanvasCommand
impl Sync for CanvasCommand
impl Unpin for CanvasCommand
impl UnsafeUnpin for CanvasCommand
impl UnwindSafe for CanvasCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more