cristinecula / pixelsnap

Automatically exported from code.google.com/p/pixelsnap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when pixelsnapping a circle

GoogleCodeExporter opened this issue · comments

Hi,

Config: Ubuntu 9.10, Inkscape 0.48 (dev), pixelsnap 0.2.

Congrats for this useful extension.
I'm currently trying it in order to include it in the next Inkscape
version, but I have an error message when I use it with a circle.
Everything works well if I convert the circle to path.

Regards.
Nicolas (jazzynico)
----
Error message:
Traceback (most recent call last):
  File "/usr/local/share/inkscape/extensions/pixelsnap.py", line 484, in
<module>
    effect.affect()
  File "/usr/local/share/inkscape/extensions/inkex.py", line 208, in affect
    self.effect()
  File "/usr/local/share/inkscape/extensions/pixelsnap.py", line 477, in effect
    self.pixel_snap(elem)
  File "/usr/local/share/inkscape/extensions/pixelsnap.py", line 464, in
pixel_snap
    self.snap_path_scale(elem, parent_transform)
  File "/usr/local/share/inkscape/extensions/pixelsnap.py", line 311, in
snap_path_scale
    self.transform_path_node([[1, 0, -min_xy[0]], [0, 1, -min_xy[1]]],
path, i)     # center transform
  File "/usr/local/share/inkscape/extensions/pixelsnap.py", line 233, in
transform_path_node
    x, y = path[i][1][j], path[i][1][j+1]
IndexError: list index out of range

Original issue reported on code.google.com by nicoduf@yahoo.fr on 29 Jan 2010 at 2:54

I've committed a fix for this issue to the SVN. Are you able to check that it 
works
for you now?

Just a note: PixelSnap doesn't really attempt to snap curves (requires more 
geometric
sophistication than I've built into it as of yet, and curves hardly benefit from
snapping anyway), and circles (i.e. elliptical arcs) are included in that. The 
fix I
committed basically avoids the error, but doesn't attempt to snap the circle.

If you convert the circle to a path, it'll snap the edges to a pixel, simply by
translating & scaling (the first step in snapping every object).

I've done a visual comparison of a snapped circular path and an unsnapped one, 
and
it's virtually impossible to tell the difference. Obviously a very large circle 
would
be more noticeable.

I skip various objects that aren't simple to snap, so I think the same approach 
is OK
for circles, too, and it would require fairly major changes to PixelSnap's 
simple
algorithm to snap every type of object.

Original comment by bryh...@gmail.com on 4 Feb 2010 at 7:11

  • Changed state: Fixed