Drawing Images with certain parts transparent

Sorry if I sound stupid, I've never done graphics in Java before.

How do I draw an image while leaving pixels of certain colors undrawn?

For example, if I have black colors on the image than it won't be drawn, and instead the corresponding parts on the destination surface is shown instead.

Or is there just anyway to perform pixel operations on 1 pixel, like getPixel and setPixel in Windows API?

Thank you.

[441 byte] By [rayli1107] at [2007-9-27 17:28:06]
# 1
Look up GraphicsConfiguration.createCompatableImage() with BITMAP transparency. Then you can load your image into that - if you use .gifs with pallette transparency set then you can load them via an ImageIcon
OrangyTang at 2007-7-6 12:31:53 > top of Java-index,Other Topics,Java Game Development...
# 2
Sorry, but I've never used GraphicsConfiguration before. Can you give a little example or point me to a tutorial or something?Thanks.
rayli1107 at 2007-7-6 12:31:53 > top of Java-index,Other Topics,Java Game Development...
# 3
The easiest way to do this is to get the graphics from a gif file which has a colour set to transparent, then the Image object won't draw that colour.
Olly_W at 2007-7-6 12:31:53 > top of Java-index,Other Topics,Java Game Development...
# 4
Thanks.
rayli1107 at 2007-7-6 12:31:53 > top of Java-index,Other Topics,Java Game Development...
# 5

DO NOT USE A GIF!

That's just bad advice. GIF's are for simple web graphics. JPG's are for high quality graphics, but have no alpha/transparency.

You need to use an image that stored transparency, but not at the expense of your graphics quality.

Use a 32-bit image type - RGBA

javanova at 2007-7-6 12:31:53 > top of Java-index,Other Topics,Java Game Development...
# 6
exactly, use png!!thats why java1.3+ supports png.png :rox:
Abuse at 2007-7-6 12:31:53 > top of Java-index,Other Topics,Java Game Development...
# 7
Yep... Take a look at http://burnallgifs.org/ and http://hackles.org/etc/png.html for info.
Adriaan. at 2007-7-6 12:31:53 > top of Java-index,Other Topics,Java Game Development...