Corel DRAW X6 file format subdued by libcdr
Two months ago we posted an announcement of a new project to deliver a library and a converter from Corel DRAW files to SVG. It's time for an update.
The project is doing very well, lots of important changes have landed to source code repository since February.
Two weeks ago Corel released a major update of its flagship product, Corel DRAW, and changed the file format yet again. It took the joint LibreOffice/re-lab team a week to notice the release and several more days to implement initial support for its files in libcdr.
The library also started reading v6 files, so libcdr goes all the way from v6 to v16 now which is quite unique. There's also some initial code to support CMX, the exchange file format by Corel used mostly for clip art.
libcdr 0.0.6 got support for page size, special shapes, polygons, B-splines and bitmaps. Some fixes were applied to reading rounded rectangles and Z-order of objects.
While improved support for dashes, better support for line styles and line types, as well as fixes in hairline emulation are fine and nice, there are even more exciting changes.
First of all, there is now an initial support for gradients. It's not exactly perfect, handles tend to shift in some cases — this will be taken care of in due time. Here is the original:
Here is the SVG opened in Inkscape:
The new version also reads HSB, HKS, LAB and HLS colors. Fridrich also consulted with Marti Maria and implemented an initial support for color managed conversion from CMYK to RGB via LittleCMS v2.
There's also support for pattern fills including pattern stretch now. In other words, libcdr currently surpasses UniConvertor in terms of supported objects and their properties (while still not preserving groups). Fridrich posted some pictures on that in his blog.
Again, if you want having a go at libcdr, it's best to deal with code from Git repository.
$ git clone git://anongit.freedesktop.org/libreoffice/libcdr
$ ./autogen.sh && ./configure && make && sudo make install
$ cdr2xhtml file.cdr > file.xhtml
Then open the XHTML file in a text editor, trim the XHTML bits and save the result as .svg to open in Inkscape.
It's quite possible that text objects will swim into focus next. The relevant preliminary reverse-engineering has already been done.
The library will be used in upcoming LibreOffice 3.6.