pub enum CanvasCommand {
Show 14 variants
FillRect {
bounds: Rect,
color: Rgba,
},
StrokeRect {
bounds: Rect,
color: Rgba,
line_width: f32,
},
ClearRect {
bounds: Rect,
},
DrawLine {
p0: (f32, f32),
p1: (f32, f32),
color: Rgba,
line_width: f32,
},
DrawCircle {
center: (f32, f32),
radius: f32,
fill_color: Option<Rgba>,
stroke_color: Option<Rgba>,
line_width: f32,
},
DrawPath {
verbs: Vec<CanvasPathVerb>,
fill_color: Option<Rgba>,
stroke_color: Option<Rgba>,
line_width: f32,
},
Save,
Restore,
SetLineDash {
segments: Vec<f32>,
offset: f32,
},
SetLineCap(StrokeLineCap),
SetLineJoin(StrokeLineJoin),
ClipPath {
verbs: Vec<CanvasPathVerb>,
},
FillText {
text: String,
x: f32,
y: f32,
color: Rgba,
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, dash state, line cap/join).
Restore
Pops the most recently pushed backend graphics state.
SetLineDash
Sets the stroke dash pattern (empty clears dashing) and phase offset.
SetLineCap(StrokeLineCap)
Sets the stroke line termination cap style (Butt, Round, Square).
SetLineJoin(StrokeLineJoin)
Sets the stroke corner join style (Miter, Round, Bevel).
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§fn clone(&self) -> CanvasCommand
fn clone(&self) -> CanvasCommand
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§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