Commit 9e7a4dd
Fix Illustrator paths
Changed files (2)
Diff
@@ -2262,16 +2262,25 @@ public class Path : GLib.Object { } remove_deleted_points ();- ++ // remove tripple points for (int i = 0; i < points.size + 1; i++) { EditPoint ep = points.get (i % points.size);- n = points.get ((i + 1) % points.size);+ EditPoint next = points.get ((i + 1) % points.size); EditPoint previous = points.get ((i - 1 + points.size) % points.size); - if (Path.distance_to_point (n, ep) < t && Path.distance_to_point (previous, ep) < t) {+ if (Path.distance_to_point (next, ep) < t && Path.distance_to_point (previous, ep) < t) { points.remove (ep); i--;- } else if (Path.distance_to_point (n, ep) < t) {+ }+ }+ + // remove points on points+ for (int i = 0; i < points.size + 1; i++) {+ EditPoint ep = points.get (i % points.size);+ n = points.get ((i + 1) % points.size);+ + if (Path.distance_to_point (n, ep) < t) { remove.add (ep); } }@@ -801,6 +801,7 @@ public class SvgFile : GLib.Object { // all instructions are padded for (int i = 0; i < points_size; i++) {+ print (@"$(bezier_points[i])\n"); // FIXME: add more types if (bezier_points[i].type == 'M') { if (i == 0) {@@ -878,11 +879,18 @@ public class SvgFile : GLib.Object { if (p.point_data.size > 8) { Points illustrator_points = new Points (); - illustrator_points.x = p.point_data.get_double (p.point_data.size - 3);- illustrator_points.y = p.point_data.get_double (p.point_data.size - 2);- + if (p.point_data.get_point_type (p.point_data.size - 8) == POINT_CUBIC) {+ illustrator_points.x = p.point_data.get_double (p.point_data.size - 3);+ illustrator_points.y = p.point_data.get_double (p.point_data.size - 2);+ } else {+ illustrator_points.x = p.point_data.get_double (p.point_data.size - 7);+ illustrator_points.y = p.point_data.get_double (p.point_data.size - 6);+ }+ int start = p.point_data.get_point_type (0) == POINT_CUBIC ? 8 : 0; + start = 0;+ for (int i = start; i < p.point_data.size; i += 1) { illustrator_points.point_data.add (p.point_data.get_double (i)); }