mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-04 13:30:48 +00:00
Convert reduce() and offset() Bezier-rs wasm demo functions to render as SVG (#783)
* convert reduce and offset wasm func to return svg * address comments
This commit is contained in:
parent
55f6d13daf
commit
dccff784c5
3 changed files with 75 additions and 49 deletions
|
@ -177,10 +177,18 @@ impl Bezier {
|
|||
|
||||
/// Appends to the `svg` mutable string with an SVG shape representation that includes the curve, the handle lines, the anchors, and the handles.
|
||||
pub fn to_svg(&self, svg: &mut String, curve_attributes: String, anchor_attributes: String, handle_attributes: String, handle_line_attributes: String) {
|
||||
self.curve_to_svg(svg, curve_attributes);
|
||||
self.handle_lines_to_svg(svg, handle_line_attributes);
|
||||
self.anchors_to_svg(svg, anchor_attributes);
|
||||
self.handles_to_svg(svg, handle_attributes);
|
||||
if !curve_attributes.is_empty() {
|
||||
self.curve_to_svg(svg, curve_attributes);
|
||||
}
|
||||
if !handle_line_attributes.is_empty() {
|
||||
self.handle_lines_to_svg(svg, handle_line_attributes);
|
||||
}
|
||||
if !anchor_attributes.is_empty() {
|
||||
self.anchors_to_svg(svg, anchor_attributes);
|
||||
}
|
||||
if !handle_attributes.is_empty() {
|
||||
self.handles_to_svg(svg, handle_attributes);
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if the corresponding points of the two `Bezier`s are within the provided absolute value difference from each other.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue