su9nil14 / canviz

Automatically exported from code.google.com/p/canviz
0 stars 0 forks source link

Support dpi graph attribute #23

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Units in xdot output are measured in PostScript points, which are always 72 
dpi. Graphviz produces 
PNG and other bitmapped output at 96 dpi by default. Canviz is supposed to 
replace using PNGs in 
web pages, and I wanted developers to have as seamless a transition as 
possible, so there's this 
curious variable "this.systemScale = 4/3" which should more properly be written 
"this.systemScale = 
96/72" to convert 72-dpi points to 96-dpi pixels so that Canviz output matches 
the size of PNG 
output.

But the graph could specify a different dpi. PNG output respects this setting 
(rendering a larger 
graph for larger dpi values) so we should do the same in Canviz.

Original issue reported on code.google.com by ryandesi...@gmail.com on 19 Oct 2008 at 6:48

GoogleCodeExporter commented 8 years ago
Here's a sample graph with a nonstandard dpi setting.

Original comment by ryandesi...@gmail.com on 19 Oct 2008 at 6:50

Attachments:

GoogleCodeExporter commented 8 years ago
Partial fix committed in r129 which takes care of the size (setting this.dpi to 
the value in the graph and setting 
this.systemScale to this.dpi / 72). But the line thickness is not right. I need 
to analyze the PNG output at absurdly 
high dpi values to see what the line thickness should be.

Original comment by ryandesi...@gmail.com on 19 Oct 2008 at 7:02

GoogleCodeExporter commented 8 years ago
I rendered a graph at 720 dpi and the lines were exactly 10 pixels wide. So I 
must conclude that the line width 
should be this.dpi / 72. Which means I was wrong with r29 and should revert it.

Original comment by ryandesi...@gmail.com on 19 Oct 2008 at 7:24

GoogleCodeExporter commented 8 years ago
Reverted r29 in r130. This fixes the line width but there's still something 
funny going on with the arrow in 
800dpi.gv -- the edge going into the arrow isn't centered in the Canviz 
rendering where it is in the PNG 
rendering.

Original comment by ryandesi...@gmail.com on 19 Oct 2008 at 7:44

GoogleCodeExporter commented 8 years ago
I'm going to call this fixed. Canviz does support the dpi attribute. It's 
unfortunate that the arrows look a little 
funny at high dpi, but I think it's just the effect of rounding. xdot expresses 
coordinates in integer points. Drawn 
at the default 96 dpi, this amounts to a fraction of a pixel of difference. But 
when scaled up to such a high dpi, 
the rounding becomes noticeable. Canviz can't fix this; the way to fix it would 
be to have Graphviz express 
coordinates in xdot format in floating-point points instead of integer points.

Original comment by ryandesi...@gmail.com on 1 Nov 2008 at 8:19