From 509730c943dad11948eb7b0bf4d74566a7d6e4fe Mon Sep 17 00:00:00 2001 From: JazzyNico Date: Thu, 12 Aug 2010 17:01:54 +0200 Subject: [PATCH] Extensions. New -Save Background- option and help tab in Gimp XCF export. --- share/extensions/gimp_xcf.inx | 18 +++++++++++++++--- share/extensions/gimp_xcf.py | 15 ++++++++++++++- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/share/extensions/gimp_xcf.inx b/share/extensions/gimp_xcf.inx index 6f24485f0..399d2a0f8 100644 --- a/share/extensions/gimp_xcf.inx +++ b/share/extensions/gimp_xcf.inx @@ -6,9 +6,21 @@ gimp_xcf.py inkex.py gimp - - false - false + + + false + false + false + + + <_param name="instructions" type="description" xml:space="preserve">This extension exports the document to Gimp XCF format according to the following options: + * Save Guides: convert all guides to Gimp guides. + * Save Grid: convert the first rectangular grid to a Gimp grid (note that the default Inkscape grid is very narrow when shown in Gimp). + * Save Background: add the document background to each converted layer. + +Each first level layer is converted to a Gimp layer. Sublayers are are concatenated and converted with their first level parent layer into a single Gimp layer. + + .xcf application/x-xcf diff --git a/share/extensions/gimp_xcf.py b/share/extensions/gimp_xcf.py index 6522f94d5..02127059c 100755 --- a/share/extensions/gimp_xcf.py +++ b/share/extensions/gimp_xcf.py @@ -29,6 +29,9 @@ except: class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) + self.OptionParser.add_option("--tab", + action="store", type="string", + dest="tab") self.OptionParser.add_option("-d", "--guides", action="store", type="inkbool", dest="saveGuides", default=False, @@ -37,6 +40,11 @@ class MyEffect(inkex.Effect): action="store", type="inkbool", dest="saveGrid", default=False, help="Save the Grid with the .XCF") + self.OptionParser.add_option("-b", "--background", + action="store", type="inkbool", + dest="layerBackground", default=False, + help="Add background color to each layer") + def output(self): pass @@ -99,6 +107,11 @@ class MyEffect(inkex.Effect): # Layers area = '--export-area-page' + opacity = '--export-background-opacity=' + if self.options.layerBackground: + opacity += "1" + else: + opacity += "0" pngs = [] names = [] path = "/svg:svg/*[name()='g' or @style][@id]" @@ -110,7 +123,7 @@ class MyEffect(inkex.Effect): else: name = id filename = os.path.join(tmp_dir, "%s.png" % id) - command = "inkscape -i %s -j %s -e %s %s " % (id, area, filename, svg_file) + command = "inkscape -i %s -j %s %s -e %s %s " % (id, area, opacity, filename, svg_file) if bsubprocess: p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE) return_code = p.wait() -- 2.30.2