[Doxygen-develop] [Patch]: Added support for SVG graphics with dot
Brought to you by:
dimitri
From: Christian E. <ce...@gm...> - 2007-11-18 17:15:21
|
Hello, I've created a patch which adds support for generating Scaleable Vector Gr= aphics instead of bitmaps (for HTML output). Most today's browsers have at least limited support f=FCr rendering svg gr= aphics. I got the best results with Opera, Konqueror is nearly Ok, Firefox has some work lef= t... SVG graphics are included with the <object></object> tag instead of <img>.= I got most information from SELFHTML (german only): http://de.selfhtml.org/html/multimedia/objekte.htm#datendateien For browsers which doens't support rendering SVG it's possible to show an = alternative content (e.g. a png graphic). Thus my patch creates additional png (fixed)= graphics when the user selects svg. Patch description (generated with 'svn diff'): - config.l: o Added 'svg' item for DOT_IMAGE_FORMAT - dot.h o Added prototype for getPngImageSize() (see open issues) - dot.cpp o Implemented getPngImageSize() (see open issues) o Generate an additional png file if the user selected svg format o Include both files as mentioned in the above tutorial - htmlvisitor.cpp: o Generate an additional png file if the user selected svg format o Include both files as mentioned in the above tutorial I've tried to adopt the existing coding style as good as possible. There s= hould be no additional changes than those mentioned above. If the user doesn't select = the svg format, the patch shouldn't have any effects. Open issues: - Image size of the SVG graphics It's not very straightforward to generate an svg file with the same image = size compared to an equal bitmap file. For reasons I don't understand the dot tool uses dif= ferent sizes for svg and png graphics. I've tried to change this by setting DPI to 96 in do= t but the resulting graphic was not rendered correctly in most of my browsers. So I've decided to get the destination size from the png file (which is al= so created) and to scale the svg to this value. This possibly strange way produced the most a= cceptable results. - Hyperlinks in the SVG graphics For resons I don't know (perhaps a bug), all hyperlinks in the doxygen gen= erated dot files start with a '$' character. This char is also present in the generated map= file. I've never seen this before but it seems that it doesn't harm. For svg graphics at least some browsers don't use the map file, they get i= nformation about hyperlinks directly from the svg file. Dot also includes the $ from the do= t file here. At least in this case, my browsers failed to follow the link until I removed the $ = char. Maybe it would be the best to remove it at all. regards Christian |