Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

Problem with transparency in png images on Mac OS X

Thread view: 
kasper@kau.dk - 26 Mar 2006 19:43 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.