Flash-compatible vector curve

As you would already know, Quixie is using Cairo for rendering vector graphics. Flash is using Quadratic Bezier curves while Cairo uses Cubic Bezier curve.

After implementing Quadratic Bezier curve, I tried creating a heart and a circle for a simple Valentine’s Day demo, until I noticed something. The image below displays the progress made to Quixie to draw a vector curve that is similar to how Flash renders a curve.

hearts

Go and click the image to view larger.

Not sure if it’s just me but it’s only know that I realize that using cubic over quadratic seem to produce better shapes. Don’t know about you guys, but I think the previous implementation of curve-rendering draws the heart and the circle much better.

As expected, looks like Quixie will have to employ both Quadtratic and Cubic Bezier curves, using CurveTo and a new Draw function CubicCurveTo.

Also, Cairo doesn’t seem to negate (can’t pick out the right word here) to overlapping shapes. Notice the hole where the heart and circle collided on Flash’s implementation?

You might be wondering why is it so important that Quixie will render vectors the way Flash do. The simple answer is, “easy adaptation” — the same reason DOC, XLS and PPT files can be opened with OpenOffice. Still, Quixie is not being developed to be an open source alternative to the Flash Player — Gnash development team has already been working on it.

By the way, the quadratic beziers are converted into Cairo’s cubic bezier by an algorithm from Mono project — the Moonlight’s moon_curve_to function.

~creek23


Posted

in

by

Tags:

Comments

4 Responses to “Flash-compatible vector curve”

  1. Andrew Avatar
    Andrew

    It’s only compatible if it’s able to play SWF files.

  2. tarner Avatar
    tarner

    when will you make an animation authoring tool?

  3. razorbite Avatar
    razorbite

    I could try helping you writing vector rendering library.

  4. svenfx Avatar
    svenfx

    +1 to tarner’s comment. You guys should start making one.

Leave a Reply to tarner Cancel reply

Your email address will not be published. Required fields are marked *