Spent a day trying to figure out why this function worked…
void transformDraw(BufferedImage bi,
Stroke st, Color c,
AffineTransform at, Shape sh)
{
Graphics2D g2d = bi.createGraphics();
g2d.setStroke(st);
g2d.seteColor(c);
g2d.draw(at.createTransformedShape(sh));
}
void transformDraw(BufferedImage bi,
Stroke st, Color c,
AffineTransform at, Shape sh)
{
Graphics2D g2d = bi.createGraphics();
g2d.setStroke(st);
g2d.seteColor(c);
g2d.transform(at);
g2d.draw(sh);
}
…always resulted in the BufferedImage being filled entirely with the stroke color when I called the function like this…
transformDraw(myBufferedImg,
new BasicStroke(3), Color.RED,
AffineTransform.getScaleInstance(100000, 100000),
myShape);
It was this pdf that helped me finally understand why those two functions are different.
No comments:
Post a Comment