About Talks Articles

Beauty is in the smoothness of the colors

2 min read

In the recent days (see also the last progress), I have implemented support for two important things for libwpg: object transformation and gradient.

Object transformation is necessary to have rotated or scaled objects. And most important is for translated objects. In Corel Presentations, when you copy an object and move the copy, the two still shares the same data but have different transformation matrix. Thus, in order to have all objects in proper location, transformation support is necessary.

Another interesting bit is gradient fill. This presents some challenge as the documentation does not say anything except the data structure, and the gradient concept in WPG does not actually fit into SVG model. After wasting many sheets of paper and scribbling lots of (mostly wrong) equations, I found the solution which may match WPG’s gradient with SVG. So far it works with linear gradient.

In the screenshot below (click for larger version), you can see the perfect conversion of the gradients. Left side: WordPerfect Office (inside emulator) shows windmill.wpg. Right side: Karbon14 opens windmill.svg, which is windmill.wpg converted to SVG using libwpg’s wpg2svg.

Note 1: there are still rendering problem as I have not yet coded proper evenodd fill rule with grouped polygons.

Note 2: Karbon here is just for illustration purpose. Inkscape (or other vector drawing programs which support SVG) works also flawlessly.

♡ this article? Explore more articles and follow me Twitter.

Share this on Twitter Facebook Google+

comments powered by Disqus