From: buliabyak Date: Mon, 20 Mar 2006 04:24:12 +0000 (+0000) Subject: copy clippaths, masks, and mask gradients to defs_clipboard X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=41b9f5f4416766ca01eedd79e2d8c201d677ab99;p=inkscape.git copy clippaths, masks, and mask gradients to defs_clipboard --- diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index a92cb1a73..91686d277 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -842,10 +842,10 @@ void sp_copy_pattern (GSList **defs_clip, SPPattern *pattern) } } -void sp_copy_marker (GSList **defs_clip, SPMarker *marker) +void sp_copy_single (GSList **defs_clip, SPObject *thing) { - Inkscape::XML::Node *marker_repr = SP_OBJECT_REPR(marker)->duplicate(); - *defs_clip = g_slist_prepend (*defs_clip, marker_repr); + Inkscape::XML::Node *duplicate_repr = SP_OBJECT_REPR(thing)->duplicate(); + *defs_clip = g_slist_prepend (*defs_clip, duplicate_repr); } @@ -884,7 +884,7 @@ void sp_copy_stuff_used_by_item (GSList **defs_clip, SPItem *item, const GSList SPShape *shape = SP_SHAPE (item); for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) { if (shape->marker[i]) { - sp_copy_marker (defs_clip, SP_MARKER (shape->marker[i])); + sp_copy_single (defs_clip, SP_OBJECT (shape->marker[i])); } } } @@ -893,6 +893,20 @@ void sp_copy_stuff_used_by_item (GSList **defs_clip, SPItem *item, const GSList sp_copy_textpath_path (defs_clip, SP_TEXTPATH(sp_object_first_child(SP_OBJECT(item))), items); } + if (item->clip_ref->getObject()) { + sp_copy_single (defs_clip, item->clip_ref->getObject()); + } + + if (item->mask_ref->getObject()) { + SPObject *mask = item->mask_ref->getObject(); + sp_copy_single (defs_clip, mask); + // recurse into the mask for its gradients etc. + for (SPObject *o = SP_OBJECT(mask)->children; o != NULL; o = o->next) { + if (SP_IS_ITEM(o)) + sp_copy_stuff_used_by_item (defs_clip, SP_ITEM (o), items); + } + } + // recurse for (SPObject *o = SP_OBJECT(item)->children; o != NULL; o = o->next) { if (SP_IS_ITEM(o))