diff options
Diffstat (limited to 'share/extensions')
| -rwxr-xr-x | share/extensions/convert2dashes.py | 9 | ||||
| -rwxr-xr-x | share/extensions/dxf_outlines.py | 13 | ||||
| -rwxr-xr-x | share/extensions/funcplot.py | 2 | ||||
| -rwxr-xr-x | share/extensions/gimp_xcf.py | 10 | ||||
| -rwxr-xr-x | share/extensions/pathalongpath.py | 4 | ||||
| -rwxr-xr-x | share/extensions/pathscatter.py | 6 | ||||
| -rw-r--r-- | share/extensions/seamless_pattern_procedural.inx | 4 | ||||
| -rwxr-xr-x | share/extensions/svg2xaml.xsl | 26 |
8 files changed, 52 insertions, 22 deletions
diff --git a/share/extensions/convert2dashes.py b/share/extensions/convert2dashes.py index 9e7f6d439..1228b247c 100755 --- a/share/extensions/convert2dashes.py +++ b/share/extensions/convert2dashes.py @@ -54,17 +54,24 @@ class SplitIt(inkex.Effect): for id, node in self.selected.iteritems(): if node.tag == inkex.addNS('path','svg'): dashes = [] + offset = 0 style = simplestyle.parseStyle(node.get('style')) if style.has_key('stroke-dasharray'): if style['stroke-dasharray'].find(',') > 0: dashes = [float (dash) for dash in style['stroke-dasharray'].split(',')] + if style.has_key('stroke-dashoffset'): + offset = style['stroke-dashoffset'] if dashes: p = cubicsuperpath.parsePath(node.get('d')) new = [] for sub in p: idash = 0 dash = dashes[0] - length = 0 + length = float (offset) + while dash < length: + length = length - dash + idash = (idash + 1) % len(dashes) + dash = dashes[idash] new.append([sub[0][:]]) i = 1 while i < len(sub): diff --git a/share/extensions/dxf_outlines.py b/share/extensions/dxf_outlines.py index f7e57c32e..091606ba3 100755 --- a/share/extensions/dxf_outlines.py +++ b/share/extensions/dxf_outlines.py @@ -113,14 +113,17 @@ class MyEffect(inkex.Effect): self.poly = [csp[0]] # initiallize new polyline self.color_LWPOLY = self.color self.layer_LWPOLY = self.layer - self.closed_LWPOLY = self.closed self.poly.append(csp[1]) def LWPOLY_output(self): if len(self.poly) == 1: return self.handle += 1 - self.dxf_add(" 0\nLWPOLYLINE\n 5\n%x\n100\nAcDbEntity\n 8\n%s\n 62\n%d\n100\nAcDbPolyline\n 90\n%d\n 70\n%d\n" % (self.handle, self.layer_LWPOLY, self.color_LWPOLY, len(self.poly), self.closed_LWPOLY)) - for i in range(len(self.poly)): + closed = 1 + if (abs(self.poly[0][0] - self.poly[-1][0]) > .0001 + or abs(self.poly[0][1] - self.poly[-1][1]) > .0001): + closed = 0 + self.dxf_add(" 0\nLWPOLYLINE\n 5\n%x\n100\nAcDbEntity\n 8\n%s\n 62\n%d\n100\nAcDbPolyline\n 90\n%d\n 70\n%d\n" % (self.handle, self.layer_LWPOLY, self.color_LWPOLY, len(self.poly) - closed, closed)) + for i in range(len(self.poly) - closed): self.dxf_add(" 10\n%f\n 20\n%f\n 30\n0.0\n" % (self.poly[i][0],self.poly[i][1])) def dxf_spline(self,csp): knots = 8 @@ -195,7 +198,6 @@ class MyEffect(inkex.Effect): if style['stroke'] and style['stroke'] != 'none' and style['stroke'][0:3] != 'url': rgb = simplestyle.parseColor(style['stroke']) hsl = coloreffect.ColorEffect.rgb_to_hsl(coloreffect.ColorEffect(),rgb[0]/255.0,rgb[1]/255.0,rgb[2]/255.0) - self.closed = 0 # only for LWPOLYLINE self.color = 7 # default is black if hsl[2]: self.color = 1 + (int(6*hsl[0] + 0.5) % 6) # use 6 hues @@ -203,11 +205,8 @@ class MyEffect(inkex.Effect): d = node.get('d') if not d: return - if (d[-1] == 'z' or d[-1] == 'Z'): - self.closed = 1 p = cubicsuperpath.parsePath(d) elif node.tag == inkex.addNS('rect','svg'): - self.closed = 1 x = float(node.get('x')) y = float(node.get('y')) width = float(node.get('width')) diff --git a/share/extensions/funcplot.py b/share/extensions/funcplot.py index 606fb0c28..f37bf335e 100755 --- a/share/extensions/funcplot.py +++ b/share/extensions/funcplot.py @@ -45,7 +45,7 @@ def drawfunction(xstart, xend, ybottom, ytop, samples, width, height, left, bott # coords and scales based on the source rect if xstart == xend: - inkex.errormsg(_("x-interval cannot be zero. Please modify 'Start X value' or 'End X alue'")) + inkex.errormsg(_("x-interval cannot be zero. Please modify 'Start X value' or 'End X value'")) return [] scalex = width / (xend - xstart) xoff = left diff --git a/share/extensions/gimp_xcf.py b/share/extensions/gimp_xcf.py index 11c9d041f..bdb0d1e4c 100755 --- a/share/extensions/gimp_xcf.py +++ b/share/extensions/gimp_xcf.py @@ -34,6 +34,10 @@ class GimpXCFError(Exception): pass class GimpXCFExpectedIOError(GimpXCFError): pass +class GimpXCFInkscapeNotInstalled(GimpXCFError): + def __init__(self): + inkex.errormsg(_('Inkscape must be installed and set in your path variable.')) + class GimpXCFGimpNotInstalled(GimpXCFError): def __init__(self): inkex.errormsg(_('Gimp must be installed and set in your path variable.')) @@ -166,7 +170,11 @@ class MyEffect(inkex.Effect): f.close() err.close() stdin.close() - + + if return_code != 0: + self.clear_tmp() + raise GimpXCFInkscapeNotInstalled + if os.name == 'nt': filename = filename.replace("\\", "/") pngs.append(filename) diff --git a/share/extensions/pathalongpath.py b/share/extensions/pathalongpath.py index 7da7f1797..234430acd 100755 --- a/share/extensions/pathalongpath.py +++ b/share/extensions/pathalongpath.py @@ -66,7 +66,7 @@ def stretch(pathcomp,xscale,yscale,org): def linearize(p,tolerance=0.001): ''' - This function recieves a component of a 'cubicsuperpath' and returns two things: + This function receives a component of a 'cubicsuperpath' and returns two things: The path subdivided in many straight segments, and an array containing the length of each segment. We could work with bezier path as well, but bezier arc lengths are (re)computed for each point @@ -153,7 +153,7 @@ class PathAlongPath(pathmodifier.Diffeo): def lengthtotime(self,l): ''' Recieves an arc length l, and returns the index of the segment in self.skelcomp - containing the coresponding point, to gether with the position of the point on this segment. + containing the corresponding point, to gether with the position of the point on this segment. If the deformer is closed, do computations modulo the toal length. ''' diff --git a/share/extensions/pathscatter.py b/share/extensions/pathscatter.py index 268e31069..5c2857979 100755 --- a/share/extensions/pathscatter.py +++ b/share/extensions/pathscatter.py @@ -80,7 +80,7 @@ def stretch(pathcomp,xscale,yscale,org): def linearize(p,tolerance=0.001): ''' - This function recieves a component of a 'cubicsuperpath' and returns two things: + This function receives a component of a 'cubicsuperpath' and returns two things: The path subdivided in many straight segments, and an array containing the length of each segment. We could work with bezier path as well, but bezier arc lengths are (re)computed for each point @@ -186,7 +186,7 @@ class PathScatter(pathmodifier.Diffeo): def lengthtotime(self,l): ''' Recieves an arc length l, and returns the index of the segment in self.skelcomp - containing the coresponding point, to gether with the position of the point on this segment. + containing the corresponding point, to gether with the position of the point on this segment. If the deformer is closed, do computations modulo the toal length. ''' @@ -203,7 +203,7 @@ class PathScatter(pathmodifier.Diffeo): def localTransformAt(self,s,follow=True): ''' - recieves a length, and returns the coresponding point and tangent of self.skelcomp + receives a length, and returns the coresponding point and tangent of self.skelcomp if follow is set to false, returns only the translation ''' i,t=self.lengthtotime(s) diff --git a/share/extensions/seamless_pattern_procedural.inx b/share/extensions/seamless_pattern_procedural.inx index f9800c63d..0c173fd0c 100644 --- a/share/extensions/seamless_pattern_procedural.inx +++ b/share/extensions/seamless_pattern_procedural.inx @@ -5,8 +5,8 @@ <dependency type="executable" location="extensions">seamless_pattern.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> - <param name="width" _gui-text="Custom Width (px.):" type="int" min="1" max="99999999">100</param> - <param name="height" _gui-text="Custom Height (px.):" type="int" min="1" max="99999999">100</param> + <param name="width" _gui-text="Custom Width (px):" type="int" min="1" max="99999999">100</param> + <param name="height" _gui-text="Custom Height (px):" type="int" min="1" max="99999999">100</param> <effect needs-live-preview="false"> <object-type>all</object-type> diff --git a/share/extensions/svg2xaml.xsl b/share/extensions/svg2xaml.xsl index fa785fa4f..d2796c93c 100755 --- a/share/extensions/svg2xaml.xsl +++ b/share/extensions/svg2xaml.xsl @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- -Copyright (c) 2005-2007 authors: +Copyright (c) 2005-2015 authors: Original version: Toine de Greef (a.degreef@chello.nl) -Modified (2010-2014) by Nicolas Dufour (nicoduf@yahoo.fr) (blur support, units +Modified (2010-2015) by Nicolas Dufour (nicoduf@yahoo.fr) (blur support, units convertion, comments, and some other fixes) Permission is hereby granted, free of charge, to any person obtaining a copy @@ -34,7 +34,8 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:exsl="http://exslt.org/common" xmlns:libxslt="http://xmlsoft.org/XSLT/namespace" -exclude-result-prefixes="rdf xlink xs exsl libxslt"> +xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" +exclude-result-prefixes="rdf xlink xs exsl libxslt inkscape"> <xsl:strip-space elements="*" /> <xsl:output method="xml" encoding="UTF-8" indent="yes"/> @@ -80,9 +81,8 @@ exclude-result-prefixes="rdf xlink xs exsl libxslt"> <Canvas> <xsl:apply-templates mode="id" select="." /> <xsl:apply-templates mode="filter_effect" select="." /> - <!-- <xsl:apply-templates mode="clip" select="." /> - --> + <xsl:if test="@style and contains(@style, 'display:none')"> <xsl:attribute name="Visibility">Collapsed</xsl:attribute> </xsl:if> @@ -178,6 +178,7 @@ exclude-result-prefixes="rdf xlink xs exsl libxslt"> * Parse transform * Apply transform + * Rotation center --> <!-- @@ -417,6 +418,20 @@ exclude-result-prefixes="rdf xlink xs exsl libxslt"> </xsl:template> <!-- + // Rotation center // + In XAML, relative to the object's bounding box (RenderTransformOrigin="0.5,0.5" is the center) + Unfortunately, converting would require that the bounding box of all objects and groups is calculated, which is rather complex... +--> +<xsl:template mode="rotation-center" match="*"> + <xsl:if test="@inkscape:transform-center-x"> +<!-- <xsl:attribute name="RenderTransformOrigin"> + <xsl:value-of select="concat(@inkscape:transform-center-x, ',', @inkscape:transform-center-y)" /> + </xsl:attribute> +-->> + </xsl:if> +</xsl:template> + +<!-- // Resources (defs) // * Resources ids @@ -2566,6 +2581,7 @@ exclude-result-prefixes="rdf xlink xs exsl libxslt"> <xsl:apply-templates mode="desc" select="." /> <xsl:apply-templates mode="clip" select="." /> + <xsl:apply-templates mode="transform" select="."> <xsl:with-param name="mapped_type" select="'Rectangle'" /> </xsl:apply-templates> |
