Computer Science Canada

Seting a transparent color.

Author:  DIIST [ Mon Jun 11, 2007 5:24 pm ]
Post subject:  Seting a transparent color.

Just wondering, say i load an image in java like so:
Java:

BufferedImage img = null;
try{
        img = ImageIO.read(new File("monkey.gif"));
    }
catch (IOException e) {
     //Should Probably do Something
}



How would i make a certain color transparent in image monkey. Say, the color white i want to make transparent in my image. How would i do so. Im making this for an application, not applet. Smile

Author:  rizzix [ Mon Jun 11, 2007 5:37 pm ]
Post subject:  RE:Seting a transparent color.

You can try setXORMode(Color c); method.. possibly. (when drawing)

Author:  DIIST [ Mon Jun 11, 2007 8:22 pm ]
Post subject:  Re: Seting a transparent color.

Are you sure there arent other ways. The method you showed me makes my screen flicker, and become bazaar. It doesn't seem to work .

Im wondering, if you have a gif file that hasa trasparent layer in it. Would it be possible to just load it and hope that it doesn't show:?

Author:  HellblazerX [ Tue Jun 12, 2007 8:17 am ]
Post subject:  RE:Seting a transparent color.

Ya, the transparent layer in a gif file will work in Java.

Author:  DIIST [ Tue Jun 12, 2007 8:21 am ]
Post subject:  Re: Seting a transparent color.

yeah. It works Smile.


: