3

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.

Juha Syrjälä
  • 33,425
  • 31
  • 131
  • 183
tigger
  • 1,856
  • 3
  • 18
  • 23
  • 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 Dec 18 '09 at 02:51

2 Answers2

2

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

Kristopher Ives
  • 5,838
  • 7
  • 42
  • 67
0

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.

tigger
  • 1,856
  • 3
  • 18
  • 23