Hi,
I have a problem with png-24 images on VM 1.4.2 on Mac OS X. The
semitransparent areas in the images does not display correcly on Mac.
Here is the code I use to load the BufferedImages:
BufferedInputStream in = getBufferedInputStream(image);
BufferedImage bufferedImage = ImageIO.read(in);
in.close();
//Optimize buffered image to environment
BufferedImage bufferedImageOpt =
GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(bufferedImage.getWidth(),
bufferedImage.getHeight(), transparency);
bufferedImageOpt.getGraphics().drawImage(bufferedImage, 0, 0, null);
bufferedImages.put(image, bufferedImageOpt);
Does anyone know how to fix this problem?
/Kasper
Steve W. Jackson - 27 Mar 2006 18:39 GMT
> Hi,
>
[quoted text clipped - 19 lines]
>
> /Kasper
What problem exactly? It's unclear to me what your code is trying to
do. Java reads PNG natively and, so far as I know, handles its
transparency without issue.
= Steve =

Signature
Steve W. Jackson
Montgomery, Alabama
steve - 27 Mar 2006 23:35 GMT
> Hi,
>
[quoted text clipped - 9 lines]
> //Optimize buffered image to environment
> BufferedImage bufferedImageOpt =
GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().get
> DefaultConfiguration().createCompatibleImage(bufferedImage.getWidth(),
> bufferedImage.getHeight(), transparency);
[quoted text clipped - 5 lines]
>
> /Kasper
if it is truly a bug, contact jeff lemas at apple , by filing a bug
report.
Steve

Signature
NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth
kasper@kau.dk - 05 Apr 2006 13:41 GMT
Ok, I will do that. It seems to be a bug in the virtual machine for
Mac. I saw a post here:
http://forum.java.sun.com/thread.jspa?messageID=4176658 with the exact
same problem.
Oliver Wong - 27 Mar 2006 23:35 GMT
> Hi,
>
[quoted text clipped - 16 lines]
>
> Does anyone know how to fix this problem?
I can't directly see anything wrong with your code. Are you implying
that you've triedthis on other systems and it works fine? Have you tried
putting your PNG in a JLabel, for example, to test if it handles the
semitransparency correctly? If not, then the problem may be with your VM,
rather than with your code.
Alternatively, post up an SSCCE, and we can try using our own
semi-transparent PNGs and see if it displays correctly on our OSes.
- Oliver