~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to share/extensions/whirl.py

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Kees Cook, Ted Gould
  • Date: 2008-02-10 14:20:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080210142016-vcnb2zqyhszu0xvb
Tags: 0.46~pre1-0ubuntu1
[ Kees Cook ]
* debian/control:
  - add libgtkspell-dev build-dep to gain GtkSpell features (LP: #183547).
  - update Standards version (no changes needed).
  - add Vcs and Homepage fields.
  - switch to new python-lxml dep.
* debian/{control,rules}: switch from dpatch to quilt for more sanity.
* debian/patches/20_fix_glib_and_gxx43_ftbfs.patch:
  - merged against upstream fixes.
  - added additional fixes for newly written code.
* debian/rules: enable parallel building.

[ Ted Gould ]
* Updating POTFILES.in to make it so things build correctly.
* debian/control:
  - add ImageMagick++ and libboost-dev to build-deps

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
class Whirl(inkex.Effect):
22
22
    def __init__(self):
23
23
        inkex.Effect.__init__(self)
24
 
        self.OptionParser.add_option("-x", "--centerx",
25
 
                        action="store", type="float", 
26
 
                        dest="centerx", default=10.0,
27
 
                        help="")
28
 
        self.OptionParser.add_option("-y", "--centery",
29
 
                        action="store", type="float", 
30
 
                        dest="centery", default=0.0,
31
 
                        help="")
32
24
        self.OptionParser.add_option("-t", "--whirl",
33
25
                        action="store", type="float", 
34
26
                        dest="whirl", default=1.0,
43
35
            if self.options.rotation == True:
44
36
                rotation = 1
45
37
            whirl = self.options.whirl / 1000
46
 
            if node.tagName == 'path':
47
 
                d = node.attributes.getNamedItem('d')
48
 
                p = cubicsuperpath.parsePath(d.value)
 
38
            if node.tag == inkex.addNS('path','svg'):
 
39
                d = node.get('d')
 
40
                p = cubicsuperpath.parsePath(d)
49
41
                for sub in p:
50
42
                    for csp in sub:
51
43
                        for point in csp:
52
 
                            point[0] -= self.options.centerx
53
 
                            point[1] -= self.options.centery
 
44
                            point[0] -= self.view_center[0]
 
45
                            point[1] -= self.view_center[1]
54
46
                            dist = math.sqrt((point[0] ** 2) + (point[1] ** 2))
55
47
                            if dist != 0:
56
48
                                a = rotation * dist * whirl
57
49
                                theta = math.atan2(point[1], point[0]) + a
58
50
                                point[0] = (dist * math.cos(theta))
59
51
                                point[1] = (dist * math.sin(theta))
60
 
                            point[0] += self.options.centerx
61
 
                            point[1] += self.options.centery
62
 
                d.value = cubicsuperpath.formatPath(p)
 
52
                            point[0] += self.view_center[0]
 
53
                            point[1] += self.view_center[1]
 
54
                node.set('d',cubicsuperpath.formatPath(p))
63
55
 
64
56
e = Whirl()
65
57
e.affect()