My blog has been moved to ariya.ofilabs.com.

Saturday, June 10, 2006

Curvey landscape

Decrypting Bezier curve in WordPerfect Graphics (WPG), for the libwpg project, turned out to be not so easy. First of all, the documentation is rather very brief. The curve is specified in some triplets, where each triplet consist of initial control point, anchor point and terminal control point. This hardly tells anything useful at all. In fact, first I thought this is about quadratic Bezier curve, which was of course wrong, as it is cubic Bezier instead.

The trick was finally quite simple, I should have though about it before. I just need to match each of those three points with the actual nodes and control points, this I got from within Corel Presentation by checking the cursor position when hovering over the corresponding points.

After knowing the meaning of the triplet points, it is quite easy to adjust the WPG-to-SVG conversion tool. As the proof, shown here the screenshot of two wonderful landscape drawings. On the left side is the WPGs inside WordPerfect Office, on the right side is the converted SVGs shown in Karbon. Quite a perfect conversion so far.

4 comments:

Anonymous said...

It looks really really nice, great work!!

Anonymous said...

Nice work, I would like to see this integrated in Inkscape.

Anonymous said...

Have you created a WPG importer for Karbon or just an external program which creates SVG and is then imported by Karbon?

Were you aware of the WPG code in Dia or was this an entirely seperate effort?

Nice work, nice pictures too.

Ariya Hidayat said...

Anonymous#2: that's up to Inkscape's developers, when libwpg is finished.

Alan: this is libwpg and it will include wpg2svg. I just loaded the SVG in Karbon, Inkscape can as well do it.
WPG code in Dia is not too much, libwpg has more ambitious targets.