3
votes

I've replaced the Java internal ImageFetcher with an own implementation using ImageIO. Some image renderers of our software, which use these images, now draw anti-aliased scaled images instead of non anti-aliased. The only change is the source of the image, which are now BufferedImages instead of Toolkit-Images.

The question now is, where is the difference? Which property causes the images to scale anti-aliased? I've always thought that the anti-alias key ONLY depends on the graphics I paint on - but this is obviously wrong.

By the way: unfortunately I cannot change the renderers.

2
Can you give us details on the different platforms that the image renderers run on and the observed behaviors? That could go a long way toward discovering what is going on. For example, Macs Java2d implementation relies on Quartz 2d which could cause significant variation on Sun's implementation.Ichorus

2 Answers

2
votes

If ImageIO.read does any anti-aliasing it's likely a platform-specific issue, as @Ichorus points out, since ImageIO.read doesn't specify anything about expected behaviour for scaling or anti-aliasing.

What you may try fiddling with is your rendering hints for your Graphics2D context before issuing g.drawImage or similar.

http://bit.ly/7b6lvg <-- Java Sun documentation on Graphics2D.setRenderingHint

0
votes

Ok, after all there is one important difference: BufferedImages are RenderedImages, ToolkitImages are not. This may cause inconsistent behavior in some cases but doesn't seem to be a Java problem in general.