summaryrefslogtreecommitdiffstats
path: root/src/sp-mask.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2006-03-19 23:19:10 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2006-03-19 23:19:10 +0000
commit56203e13823d18965321e46218f4d2995287383d (patch)
tree608ea929af1aafc1b820344662881ed52ea34966 /src/sp-mask.cpp
parentrestore broken ngettext (diff)
downloadinkscape-56203e13823d18965321e46218f4d2995287383d.tar.gz
inkscape-56203e13823d18965321e46218f4d2995287383d.zip
patch by Andrius R. for (un)clip and (un)mask commands
(bzr r263)
Diffstat (limited to 'src/sp-mask.cpp')
-rw-r--r--src/sp-mask.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp
index 456dadc5f..773169d68 100644
--- a/src/sp-mask.cpp
+++ b/src/sp-mask.cpp
@@ -19,6 +19,7 @@
#include "enums.h"
#include "attributes.h"
#include "document.h"
+#include "document-private.h"
#include "sp-item.h"
#include "sp-mask.h"
@@ -266,6 +267,28 @@ sp_mask_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
return repr;
}
+// Create a mask element (using passed elements), add it to <defs>
+const gchar *
+sp_mask_create (GSList *reprs, SPDocument *document)
+{
+ Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
+
+ Inkscape::XML::Node *repr = sp_repr_new ("svg:mask");
+ repr->setAttribute("maskUnits", "userSpaceOnUse");
+
+ defsrepr->appendChild(repr);
+ const gchar *mask_id = repr->attribute("id");
+ SPObject *mask_object = document->getObjectById(mask_id);
+
+ for (GSList *it = reprs; it != NULL; it = it->next) {
+ Inkscape::XML::Node *node = (Inkscape::XML::Node *)(it->data);
+ mask_object->appendChildRepr(node);
+ }
+
+ Inkscape::GC::release(repr);
+ return mask_id;
+}
+
NRArenaItem *
sp_mask_show (SPMask *mask, NRArena *arena, unsigned int key)
{