Menu

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 on the link below displays the progress made to Quixie to draw a vector curve that is similar to how Flash renders a curve.

http://konsolscript.org/web/wp-content/uploads/2011/02/hearts-300x105.png

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 by Mj Mendoza IV 2011-02-04

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.