[Bug 714717] Re: Optimizing some cubic beziers away

jazzynico 714717 at bugs.launchpad.net
Sat Feb 14 14:36:47 UTC 2015


** Changed in: inkscape
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to scour in Ubuntu.
https://bugs.launchpad.net/bugs/714717

Title:
  Optimizing some cubic beziers away

Status in Inkscape: A Vector Drawing Tool:
  Fix Released
Status in Scour - Cleaning SVG Files:
  Fix Released
Status in scour package in Ubuntu:
  Fix Released

Bug description:
  When optimizing paths, scour discards commands which don’t advance the
  path, that is, which have a relative movement of 0,0. But this is
  wrong in the case of cubic beziers. For example, a path

      <path d="m 100,100 c 10,0 0,10 0,0 z"/>

  is a raindrop-like figure, but scour only looks at the last 0,0,
  decides the "c" command to be superfluous and turns it into

      <path d="m100,100z"/>

  which results in a different visual rendering. The right thing to do
  would be to look at all three coordinates of a cubic bezier command
  and only delete the command if all three of them are zero.

  I encounter shapes like this quite often with vectorized scans of
  drawings I aggressively simplified within Inkscape (if someone is
  interested, I can include a test file, but I hope it should be clear
  what I’m talking about anyway).

  Within cleanPath, and within the '# remove empty segments'-segment,
  the code

  elif cmd == 'c':
      while i < len(data):
          if data[i+4] == data[i+5] == 0:
              del data[i:i+6]
              numPathSegmentsReduced += 1
          else:
              i += 6

  should be replaced with

  elif cmd == 'c':
      while i < len(data):
          if data[i] == data[i+1] == data[i+2] == data[i+3] == data[i+4] == data[i+5] == 0:
              del data[i:i+6]
              numPathSegmentsReduced += 1
          else:
              i += 6

To manage notifications about this bug go to:
https://bugs.launchpad.net/inkscape/+bug/714717/+subscriptions



More information about the foundations-bugs mailing list