pub trait CanvasContext {
type Pattern;
Show 68 methods
// Required methods
fn get_direction(&self) -> Direction;
fn set_direction(&self, value: Direction) -> String;
fn set_fill_color(&self, value: Color);
fn set_fill_gradient(&self, value: &Gradient);
fn set_fill_pattern(&self, value: &Self::Pattern);
fn get_filter(&self) -> String;
fn set_filter(&self, value: &str);
fn get_font(&self) -> String;
fn set_font(
&self,
family: &str,
style: TextStyle,
weight: TextWeight,
size: f64,
);
fn get_global_alpha(&self) -> f64;
fn set_global_alpha(&self, value: f64);
fn get_global_composite_operation(&self) -> String;
fn set_global_composite_operation(&self, value: &str);
fn is_image_smoothing_enabled(&self) -> bool;
fn set_image_smoothing(&self, value: bool);
fn get_line_cap(&self) -> LineCap;
fn set_line_cap(&self, value: LineCap);
fn get_line_dash_offset(&self) -> f64;
fn set_line_dash_offset(&self, value: f64);
fn get_line_join(&self) -> LineJoin;
fn set_line_join(&self, value: LineJoin);
fn get_line_width(&self) -> f64;
fn set_line_width(&self, value: f64);
fn get_miter_limit(&self) -> f64;
fn set_miter_limit(&self, value: f64);
fn get_shadow_blur(&self) -> f64;
fn set_shadow_blur(&self, value: f64);
fn get_shadow_color(&self) -> Color;
fn set_shadow_color(&self, value: Color);
fn get_shadow_offset_x(&self) -> f64;
fn set_shadow_offset_x(&self, value: f64);
fn get_shadow_offset_y(&self) -> f64;
fn set_shadow_offset_y(&self, value: f64);
fn set_stroke_color(&self, value: Color);
fn set_stroke_gradient(&self, value: &Gradient);
fn set_stroke_pattern(&self, value: &Self::Pattern);
fn get_text_align(&self) -> TextAlign;
fn set_text_align(&self, value: TextAlign);
fn get_text_baseline(&self) -> BaseLine;
fn set_text_baseline(&self, value: BaseLine);
fn arc(
&self,
x: f64,
y: f64,
radius: f64,
start_angle: f64,
end_angle: f64,
anticlockwise: bool,
);
fn arc_to(&self, x1: f64, y1: f64, x2: f64, y2: f64, radius: f64);
fn begin_path(&self);
fn bezier_curve_to(
&self,
cp1x: f64,
cp1y: f64,
cp2x: f64,
cp2y: f64,
x: f64,
y: f64,
);
fn clear_rect(&self, x: f64, y: f64, width: f64, height: f64);
fn close_path(&self);
fn ellipse(
&self,
x: f64,
y: f64,
radius_x: f64,
radius_y: f64,
rotation: f64,
start_angle: f64,
end_angle: f64,
anticlockwise: bool,
);
fn fill(&self);
fn fill_rect(&self, x: f64, y: f64, width: f64, height: f64);
fn fill_text(&self, text: &str, x: f64, y: f64);
fn get_line_dash(&self) -> Vec<f64>;
fn line_to(&self, x: f64, y: f64);
fn measure_text(&self, text: &str) -> TextMetrics;
fn move_to(&self, x: f64, y: f64);
fn quadratic_curve_to(&self, cpx: f64, cpy: f64, x: f64, y: f64);
fn rect(&self, x: f64, y: f64, width: f64, height: f64);
fn reset_transform(&self);
fn restore(&self);
fn rotate(&self, angle: f64);
fn save(&self);
fn scale(&self, x: f64, y: f64);
fn set_line_dash(&self, dash: &Vec<f64>);
fn set_transform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64);
fn stroke(&self);
fn stroke_rect(&self, x: f64, y: f64, width: f64, height: f64);
fn stroke_text(&self, text: &str, x: f64, y: f64);
fn transform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64);
fn translate(&self, x: f64, y: f64);
}
Required Associated Types§
Required Methods§
Sourcefn get_direction(&self) -> Direction
fn get_direction(&self) -> Direction
Get direction
Sourcefn set_direction(&self, value: Direction) -> String
fn set_direction(&self, value: Direction) -> String
Set direction
Sourcefn set_fill_color(&self, value: Color)
fn set_fill_color(&self, value: Color)
Set fill color
Sourcefn set_fill_gradient(&self, value: &Gradient)
fn set_fill_gradient(&self, value: &Gradient)
Set fill gradient
Sourcefn set_fill_pattern(&self, value: &Self::Pattern)
fn set_fill_pattern(&self, value: &Self::Pattern)
Set fill pattern
Sourcefn get_filter(&self) -> String
fn get_filter(&self) -> String
Get filter
Sourcefn set_filter(&self, value: &str)
fn set_filter(&self, value: &str)
Set filter
Sourcefn set_font(
&self,
family: &str,
style: TextStyle,
weight: TextWeight,
size: f64,
)
fn set_font( &self, family: &str, style: TextStyle, weight: TextWeight, size: f64, )
Set direction
Sourcefn get_global_alpha(&self) -> f64
fn get_global_alpha(&self) -> f64
Get global alpha
Sourcefn set_global_alpha(&self, value: f64)
fn set_global_alpha(&self, value: f64)
Set global alpha
Sourcefn get_global_composite_operation(&self) -> String
fn get_global_composite_operation(&self) -> String
Get global composite operation
Sourcefn set_global_composite_operation(&self, value: &str)
fn set_global_composite_operation(&self, value: &str)
Set global composite operation
Sourcefn is_image_smoothing_enabled(&self) -> bool
fn is_image_smoothing_enabled(&self) -> bool
Whether images and patterns on this canvas will be smoothed when this canvas is scaled.
Sourcefn set_image_smoothing(&self, value: bool)
fn set_image_smoothing(&self, value: bool)
Set image smoothing
Sourcefn get_line_cap(&self) -> LineCap
fn get_line_cap(&self) -> LineCap
Get line cap
Sourcefn set_line_cap(&self, value: LineCap)
fn set_line_cap(&self, value: LineCap)
Set line cap
Sourcefn get_line_dash_offset(&self) -> f64
fn get_line_dash_offset(&self) -> f64
Get line dash offset
Sourcefn set_line_dash_offset(&self, value: f64)
fn set_line_dash_offset(&self, value: f64)
Set line dash offset
Sourcefn get_line_join(&self) -> LineJoin
fn get_line_join(&self) -> LineJoin
Get line join
Sourcefn set_line_join(&self, value: LineJoin)
fn set_line_join(&self, value: LineJoin)
Set line dash
Sourcefn get_line_width(&self) -> f64
fn get_line_width(&self) -> f64
Get line width
Sourcefn set_line_width(&self, value: f64)
fn set_line_width(&self, value: f64)
Set line width
Sourcefn get_miter_limit(&self) -> f64
fn get_miter_limit(&self) -> f64
Get miter limit
Sourcefn set_miter_limit(&self, value: f64)
fn set_miter_limit(&self, value: f64)
Set miter limit
Sourcefn get_shadow_blur(&self) -> f64
fn get_shadow_blur(&self) -> f64
Get shadow blur
Sourcefn set_shadow_blur(&self, value: f64)
fn set_shadow_blur(&self, value: f64)
Set shadow blur
Sourcefn get_shadow_color(&self) -> Color
fn get_shadow_color(&self) -> Color
Get shadow color
Sourcefn set_shadow_color(&self, value: Color)
fn set_shadow_color(&self, value: Color)
Set shadow color
Sourcefn get_shadow_offset_x(&self) -> f64
fn get_shadow_offset_x(&self) -> f64
Get shadow offset x
Sourcefn set_shadow_offset_x(&self, value: f64)
fn set_shadow_offset_x(&self, value: f64)
Set shadow offset x
Sourcefn get_shadow_offset_y(&self) -> f64
fn get_shadow_offset_y(&self) -> f64
Get shadow offset y
Sourcefn set_shadow_offset_y(&self, value: f64)
fn set_shadow_offset_y(&self, value: f64)
Set shadow offset y
Sourcefn set_stroke_color(&self, value: Color)
fn set_stroke_color(&self, value: Color)
Set stroke color
Sourcefn set_stroke_gradient(&self, value: &Gradient)
fn set_stroke_gradient(&self, value: &Gradient)
Set stroke gradient
Sourcefn set_stroke_pattern(&self, value: &Self::Pattern)
fn set_stroke_pattern(&self, value: &Self::Pattern)
Set stroke pattern
Sourcefn get_text_align(&self) -> TextAlign
fn get_text_align(&self) -> TextAlign
Get text align
Sourcefn set_text_align(&self, value: TextAlign)
fn set_text_align(&self, value: TextAlign)
Set text align
Sourcefn get_text_baseline(&self) -> BaseLine
fn get_text_baseline(&self) -> BaseLine
Get text baseline
Sourcefn set_text_baseline(&self, value: BaseLine)
fn set_text_baseline(&self, value: BaseLine)
Set text baseline
Sourcefn arc(
&self,
x: f64,
y: f64,
radius: f64,
start_angle: f64,
end_angle: f64,
anticlockwise: bool,
)
fn arc( &self, x: f64, y: f64, radius: f64, start_angle: f64, end_angle: f64, anticlockwise: bool, )
Add arc to current path with anticlockwise param
Sourcefn begin_path(&self)
fn begin_path(&self)
Begin the path
Sourcefn bezier_curve_to(
&self,
cp1x: f64,
cp1y: f64,
cp2x: f64,
cp2y: f64,
x: f64,
y: f64,
)
fn bezier_curve_to( &self, cp1x: f64, cp1y: f64, cp2x: f64, cp2y: f64, x: f64, y: f64, )
Add bezier curve to current path
Sourcefn clear_rect(&self, x: f64, y: f64, width: f64, height: f64)
fn clear_rect(&self, x: f64, y: f64, width: f64, height: f64)
Clear rectangle on current canvas
Sourcefn close_path(&self)
fn close_path(&self)
Close the current path
Sourcefn ellipse(
&self,
x: f64,
y: f64,
radius_x: f64,
radius_y: f64,
rotation: f64,
start_angle: f64,
end_angle: f64,
anticlockwise: bool,
)
fn ellipse( &self, x: f64, y: f64, radius_x: f64, radius_y: f64, rotation: f64, start_angle: f64, end_angle: f64, anticlockwise: bool, )
Add ellipse to current path
Sourcefn get_line_dash(&self) -> Vec<f64>
fn get_line_dash(&self) -> Vec<f64>
Get line dash
Sourcefn measure_text(&self, text: &str) -> TextMetrics
fn measure_text(&self, text: &str) -> TextMetrics
Measure text using current font face and font size
Sourcefn quadratic_curve_to(&self, cpx: f64, cpy: f64, x: f64, y: f64)
fn quadratic_curve_to(&self, cpx: f64, cpy: f64, x: f64, y: f64)
Add quadratic curve to current path
Sourcefn reset_transform(&self)
fn reset_transform(&self)
Reset current transformations
Sourcefn set_line_dash(&self, dash: &Vec<f64>)
fn set_line_dash(&self, dash: &Vec<f64>)
Set line dash
Sourcefn stroke_text(&self, text: &str, x: f64, y: f64)
fn stroke_text(&self, text: &str, x: f64, y: f64)
Stroke text