I'm working with the
JFreeChart library (www.jfree.org) and I am
trying to resolve a discrepancy in the rendering of bars on bar chart.
Basically I have a Rectangle2D shape representing a bar and I fill that shape
and then draw it with a different color. The shape has a couple of
translations applied but I don't think there are any other
transformations. So I should get a filled rectangle on the screen with an
outline. However, sometimes the outline does not match the filled
shape. There are gaps on some occasions on the edges and sometimes the
fill overruns the boundaries of the draw.
I found this message
from Jim Graham on mail-archive.com regarding this problem:
Jim states that this
problem is fixed in the 1.4 runtimes where both fills and strokes are normalized
by default, but that doesn't appear to be the case for me on 1.4.2_02.
When I set KEY_STROKE_CONTROL to STROKE_PURE, the gaps and overruns disappear,
but now some of the edges of the stroke are thicker than others so it doesn't
look uniform. When I antialias everything, it looks good, but I'd prefer
to stay away from AA for the time being.
Am I missing
something or does anyone have any hints on how to resolve this
problem?
I'm working on
Windows XP Professional with java 1.4.2_02 and JFreeChart
0.9.16.
The code for this is
as simple as:
Rectangle2D bar =
...;
g2.setPaint(gradientPaint);
g2.fill(bar);
g2.setColor(Color.black);
g2.draw(bar);
Thanks,
-Brian
