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

Friday, July 28, 2006

wpg2odg, wpg viewer, vs microsoft

I hope I don't bore the readers with another Whiskey-Papa-Golf goodies.

So far, at least I make some steady progress with the wpg2odg. Yes, this is a command-line tool which will convert WordPerfect Graphics into OpenDocument Graphics. From perfection to openness, so to speak. The corresponding UNO service (for seamless import from within OpenOffice.org) is planned, but I can't say when I could finish it.

As style handling in ODG is more complicated than SVG, my work with respect to stroke and fill properties of the objects isn't very fast. However, at least the outlines/paths are already imported properly. Shown in the screenshot below is OpenOffice.org opening eiffel.odg, which is the result of running "wpg2odg eiffel.wpg eiffel.odg". Compare it to the rendering in Corel Presentation and Inkscape as in my previous blog entry. So, it's like Eiffel in wireframe mode.

Of course, it's rather boring. But given couple of more days, I hope all the wonderful colors will be there.

Since libwpg is designed to be portable, I checked its status in non-Linux environment. So far I have tried to compile it on Win32 (not necessarily as dynamic library, lack of knowledge from my side) and it works well. At least with Microsoft, Borland, and GCC (Mingw) compilers. I am going to give it a try with Digital Mars and OpenWatcom later on, but I don't foresee any serious problem with the code.

I used the chance also to verify Perfectspot, another toy of mine which uses libwpg to show WPG files. So basically it's a stand-alone WPG viewer. I'll perhaps release it when it's fully polished, not sure yet whether there is a demand for such tool. Perfectspot is Qt4-based and using Arthur to render the graphics onto the screen. Screenshot can be seen below. The beautiful Earth is drawn by Marcelo Staudt (available in from Open Clip Art library). I just imported his SVG file into Corel Presentation X3 and then save it as WPG. Perfectspot opens and displays the WPG file just fine. Note how smooth is Perfectspot's rendering due to the antialiasing feature in Qt4, compared to that of Presentation's.

Since this blog got anothers hits from someone at microsoft.com with respect to WPG stuff, I decided to find out how good is the support for WPG in Microsoft Office. I inserted my favorite windmill picture (see the entry on gradient support) in PowerPoint 2002 and this is what I got:

Seems that the importer and/or PowerPoint has problem with compound polygons or grouped objects. Look at the blade in the middle (which consists of some sub paths), it should be transparent just like the other blades. Compare it to what our wonderful Karbon14 renders:

Also notice the lack of antialiasing in PowerPoint. Strangely enough, this is only for imported pictures. When I clicked and converted the inserted picture into Office drawing, then it was smoothly painted.

Alas, I saw another problem with the gradients. Instead of creating polygon with gradient fill, the import filter of PowerPoint splits the polygon into smaller polygon and fills it with solid color, as can be seen below (I select couple of those polygons to show that they are many many small objects indeed). You can quickly spot it if your eyes have native Sobel filter :-)

Is it only the case with Microsoft Office 2002? To verify it, I gave Office 2007 Beta a try. Despite its brand new user interface, it is just the same case: one blade is not transparent and gradient is converted to color bands:

Conclusion: when I am finally finished with all this endeavour, it is likely that applications like OpenOffice.org, Karbon14, and Inkscape can handle WPG files better than Microsoft Office. Or should we ask Microsoft to just use libwpg?

4 comments:

Anonymous said...

When all is said and done, does this WordPerfect format really matter? I don't know any home or office user who has used that suite of applications in a long time.

So, yes, yay! we beat Microsoft, but is this the best place to beat them at?

Anonymous said...

It looks like great work!
One thing that you could mention is that the karbon14 shots show anti-aliasing using libart, and that future version using qt4 should render equally good or better, and probably faster! :) At least it was a bit confusing for me, first reading qt4 rendering, then no explanation on why karbon14 renders nicely. I think just a small explanation could make it a bit clearer.
Cheers,

Rob.

Ariya Hidayat said...

Anonymous: I don't know whether the format really matters or not, but for sure there are still WP users. Check e.g. forums in wpuniverse.com

Just to clarify, fortunately I don't have any motivation to "beat" Microsoft at anytime. I just checked their WPG support because of the said reason. More than that, I don't really care.

Rob: Thanks.
And as a matter of fact, I (and probably also others) just take it for granted that Karbon14 renders the picture smoothly :-)

Anonymous said...

I, for one find this is a great capability to have available! My wife and I used WordPerfect products for many years before switching over to Open Source (Linux/OOo/etc.), and still have a ton of clipart and original art in .wpg format. I look forward to being able to use them again. Kudos and great work!
Now if there were only a way to convert all the old .cdr files (Corel Draw) I was given by a friend...