[Output Generation] gradient Y-coordinate in xdot not correct
Ported Issue from Mantis Original ID: 2336 Reported By: ryandesign
SEVERITY: NORMAL Submitted: 2013-08-24 11:23:07
OS: OS X
OS BUILD: 10.8.4
PLATFORM: X86_64
DESCRIPTION
When rendering xdot output for a graph using gradients, the Y-coordinate is inverted.
In the attached graph, there is a single node which should have a gradient fill from white at the bottom to black at the top.
Using the normal Graphviz coordinate system where (0,0) is in the lower left, the bounding box is drawn by the xdot command "P 4 54 36 0 36 0 0 54 0", so the top is at 36 and the bottom is at 0.
But the gradient fill is specified by the xdot command "C 42 -[27 -0 27 -36 2 0 7 -#ffffff 1 7 -#000000]", so the gradient starts at white at coordinate (27,-0) and ends at black at coordinate (27,-36) -- off the bottom of the canvas!
The correct gradient fill specification would be "C 40 -[27 0 27 36 2 0 7 -#ffffff 1 7 -#000000]".
So far in my tests, I can just flip the sign of the Y-coordinate.
In inverted-Y mode ("dot -y") the gradient is specified by "C 41 -[27 36 27 72 2 0 7 -#ffffff 1 7 -#000000]" so I can make that work by subtracting the Y-coordinates from the height.
Since this bug was released in a stable version of Graphviz 2.32.0, you might consider increasing the xdotversion to 1.4.1 when fixing this bug, so that xdot renderers can detect the buggy version 1.4 and translate the coordinates in that case.
STEPS TO REPRODUCE
dot -Txdot gradient3.gv > gradient3.gv.xdot