[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swftools-common] swfc: Importing SVG elliptical arcs

From: Vladimir Dzhuvinov
Subject: [Swftools-common] swfc: Importing SVG elliptical arcs
Date: Sun, 25 Nov 2007 18:08:10 +0200
User-agent: Thunderbird (X11/20070728)

Hi Matthias,

> While at it, could I trouble you for a patch concerning
> the SVG issue you reported a few days ago? (The parser
> routine is in lib/drawer.c (getToken()), if that's any help)

I suppose you refer to my post on importing Inkscape SVG "A" or "arc"
commands. It took me a while to recall that :)

Well, I circumvented this problem shortly afterwards with minimum effort :)

Basically, in Inkscape I noticed that when I drew a smaller object (e.g.
rectangle) within the ellipse/circle and did a union of the two - the
resulting object - which should obviously have the unmodified outline of
the outer ellipse/circle, was no longer described with "arc" commands,
but instead with 4 usual "C" (bezier)commands which swfc understands well.

This solution, at least to me, seemed a lot easier than hacking the
swftools code ;)

Nevertheless, I had a look at the SVG 1.1 paths spec. It defines
circles/ellipsis/arcs using end-point parametrisation instead of the
more geometrically common center parametrisation. Either way, to code
that is not trivial.

The first thing that came to my mind was to approximate the arcs with
bezier curves that you have already programmed into swftools.

I found a paper on the web that describes this - "Drawing an elliptical
arc using polylines ,quadratic or cubic Bezier curves" at
It comes with example Java code too.

Tellingly, I also found a message
[http://uncommonplace.com/blog/?p=254#comment-1453] saying that Inkscape
was in fact using this approximation method to draw elliptical arcs by
using a bezier for every 90 deg. The experience I had with Inkscape -
producing 4 beziers (360deg/4=90deg) for a circle/ellipse seems in line
with that.

Now, my laziness tells me to stay away from hacking these horrible arcs,
unless a really pressing and compelling need arises :)


Vladimir Dzhuvinov * www.TheTransactionCompany.com * PGP key ID AC9A5C6C

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]