[librsvg] path_builder.rs: Declare a PathCommand enum
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] path_builder.rs: Declare a PathCommand enum
- Date: Wed, 23 Aug 2017 01:57:28 +0000 (UTC)
commit d7aff34d2fa7e5b6c059b049b9f50ed858949ebc
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Mar 2 12:15:52 2017 -0600
path_builder.rs: Declare a PathCommand enum
We will move PathBuilder from storing cairo::PathSegment directly, to
storing its own PathCommand. This will be an enum similar to Cairo's,
but that can also store SVG's Arc command, and possibly SVG's quadratic
Béziers, too.
Currently, when adding markers to a path, we have unwanted markers in
the middle of arcs, as they get exploded into Bézier curve segments. By
having our own Arc PathCommand, we can defer the arc-to-Béziers step
until we finally feed the PathBuilder into Cairo.
This should also make it possible to have tests for parsing Arc
commands; currently there are none.
rust/src/path_builder.rs | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/rust/src/path_builder.rs b/rust/src/path_builder.rs
index 55993bd..a7bda6f 100644
--- a/rust/src/path_builder.rs
+++ b/rust/src/path_builder.rs
@@ -4,6 +4,13 @@ use ::cairo_sys;
use std::f64;
use std::f64::consts::*;
+pub enum PathCommand {
+ MoveTo (f64, f64),
+ LineTo (f64, f64),
+ CurveTo ((f64, f64), (f64, f64), (f64, f64)), // (x2, y2), (x3, y3), (x4, y4) <- this is the destination
point
+ ClosePath
+}
+
#[repr(C)]
pub struct RsvgPathBuilder {
path_segments: Vec<cairo::PathSegment>,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]