Code

Patch by Popolon to fix bug "[ 1562520 ] Object to path removes mask & clip-path"
authorjohanengelen <johanengelen@users.sourceforge.net>
Sat, 30 Sep 2006 16:29:24 +0000 (16:29 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Sat, 30 Sep 2006 16:29:24 +0000 (16:29 +0000)
src/path-chemistry.cpp
src/splivarot.cpp

index 0c35020b775e10141f2867be5b0503ca219535df..1415f85e6138ffba4ab87f7164783d2dbc39a45a 100644 (file)
@@ -329,6 +329,17 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 text_grouping_policy)
                                                  SP_OBJECT_STYLE(SP_OBJECT_PARENT(item)));
     repr->setAttribute("style", style_str);
     g_free(style_str);
+
+    /* Mask */
+    gchar *mask_str = (gchar *) SP_OBJECT_REPR(item)->attribute("mask");
+    if ( mask_str )
+        repr->setAttribute("mask", mask_str);
+
+    /* Clip path */
+    gchar *clip_path_str = (gchar *) SP_OBJECT_REPR(item)->attribute("clip-path");
+    if ( clip_path_str )
+        repr->setAttribute("clip-path", clip_path_str);
+
     /* Rotation center */
     sp_repr_set_attr(repr, "inkscape:transform-center-x", SP_OBJECT_REPR(item)->attribute("inkscape:transform-center-x"));
     sp_repr_set_attr(repr, "inkscape:transform-center-y", SP_OBJECT_REPR(item)->attribute("inkscape:transform-center-y"));
index 2fd01cb69c7cabb104f084b0d1eb33fb49f882c7..242cf3a24bf6e869040827f54f0725f7a1dbd75e 100644 (file)
@@ -1408,6 +1408,8 @@ sp_selected_path_simplify_item(SPDesktop *desktop,
     sp_item_write_transform(item, SP_OBJECT_REPR(item), NR::identity());
 
     gchar *style = g_strdup(SP_OBJECT_REPR(item)->attribute("style"));
+    gchar *mask = g_strdup(SP_OBJECT_REPR(item)->attribute("mask"));
+    gchar *clip_path = g_strdup(SP_OBJECT_REPR(item)->attribute("clip-path"));
 
     Path *orig = Path_for_item(item, false);
     if (orig == NULL) {
@@ -1439,8 +1441,21 @@ sp_selected_path_simplify_item(SPDesktop *desktop,
 
     Inkscape::XML::Node *repr = sp_repr_new("svg:path");
 
+    // restore style, mask and clip-path
     repr->setAttribute("style", style);
+    g_free(style);
+
+    if ( mask ) {
+        repr->setAttribute("mask", mask);
+        g_free(mask);
+    }
+
+    if ( clip_path ) {
+        repr->setAttribute("clip-path", clip_path);
+        g_free(clip_path);
+    }
 
+    // path
     gchar *str = orig->svg_dump_path();
     repr->setAttribute("d", str);
     g_free(str);