Re: DIA SVG export



At 26.01.2011 09:41, Max Wahler wrote:
Okay, here we are, sooner than I expected =)

I attached two files to this post and hopefully, I did not edit any
other that I forgot to attach.

In pydia-render.c, I added draw_rounded_rect and fill_rounded_rect and
declared them at the bottom of the file. I needed that to get pretty
clean SVG code that's rendered correctly in Firefox. Before that, other
functions like ellipse or arc were used to achieve this and that ended
up in strange results.

Still can't see a difference with my test file render-test.dia but pushed the PyDia part anyway. I've also "ported" your *_rounded_rect() implementation to diasvg.py. See:

http://git.gnome.org/browse/dia/commit/?id=97c5d4c873e6165b51109dcf13e13c1764298161

The other file I added is my diasvgcss.py file. It's based on Hans'
diasvg.py with the following modifications:

- scale all coordinates and line widths with 20 (as in the C renderer)
With my tests this is only necessary for broken renderers and I like keeping the sample diasvg.py clean of it.

- corrected SVG viewBox (width must be width-x, height must be height-x,
that thing made me nearly crazy *g*)
I'll merge that one, too.

- put all objects in group tags
- added meta id as group class
- added object name as group name
- if an item has a meta id, the fill or stroke value is saved in a
separate CSS file (<svgname>.css), if not it's saved in the tag itself

These appear to be a bit too specific for the sample code ...

I hope that my modifications are useful to someone else than me so that
they find their way to the default Dia version. Please be kind if there
are any C or Python mistakes, I did not have much contact to either
before that ;-)

Thanks for the updates, I haven't found anything obviously wrong in your code :-)

[...]
If anyone's interested in, I could also merge my modifications to the
original diasvg.py, except the export of the CSS attributes. I'm always
interested in feedback, so if you've got any questions or suggestions,
feel free to drop me a line. Let me know what you think about it!

As I already said I'd like to keep some differences between the different SVG renderers of Dia; I've fixed the obvious bug though.

Thanks,
        Hans

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]