Bezier-rs: Convert from canvas to svg for constructors (#776)

* Convert constructor to use svg

* Convert the through_points functions to svg

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Hannah Li 2022-09-26 19:14:27 -07:00 committed by Keavon Chambers
parent 8dce2144c4
commit e9cd792635
10 changed files with 308 additions and 57 deletions

View file

@ -28,12 +28,12 @@ pub struct ToSVGOptions {
impl ToSVGOptions {
/// Combine and format curve styling options for an SVG path.
pub(crate) fn formatted_curve_arguments(&self) -> String {
pub fn formatted_curve_arguments(&self) -> String {
format!(r#"stroke="{}" stroke-width="{}" fill="none""#, self.curve_stroke_color, self.curve_stroke_width)
}
/// Combine and format anchor styling options an SVG circle.
pub(crate) fn formatted_anchor_arguments(&self) -> String {
pub fn formatted_anchor_arguments(&self) -> String {
format!(
r#"r="{}", stroke="{}" stroke-width="{}" fill="{}""#,
self.anchor_radius, self.anchor_stroke_color, self.anchor_stroke_width, self.anchor_fill
@ -41,7 +41,7 @@ impl ToSVGOptions {
}
/// Combine and format handle point styling options for an SVG circle.
pub(crate) fn formatted_handle_point_arguments(&self) -> String {
pub fn formatted_handle_point_arguments(&self) -> String {
format!(
r#"r="{}", stroke="{}" stroke-width="{}" fill="{}""#,
self.handle_point_radius, self.handle_point_stroke_color, self.handle_point_stroke_width, self.handle_point_fill
@ -49,7 +49,7 @@ impl ToSVGOptions {
}
/// Combine and format handle line styling options an SVG path.
pub(crate) fn formatted_handle_line_arguments(&self) -> String {
pub fn formatted_handle_line_arguments(&self) -> String {
format!(r#"stroke="{}" stroke-width="{}" fill="none""#, self.handle_line_stroke_color, self.handle_line_stroke_width)
}
}