Alpha Color on Images?
Okay, Let's see if anyone knows this. Let's say I have a Image and I want to make the background transparent. It's certainly possible to load a transparent GIF89A, but say I want a normal gif and I want to "transparentize" it in code. Here's a code I have:
//Precondition: 'global' is a predefined JApplet
// 'opaque' is a predefined Image with w,h > 0,0
//Postcondition: An Image is returned with the background (as defined
//as the color of the top-left pixel) replaced by the GIF89A
//"transparent color"
public Image makeTransparent(Image opaque)
{
//makes an Image that is the same size as 'opaque'
Image trans = global.createImage( opaque.getWidth(global), opaque.getHeight(global) );
//gives me a graphics object to draw on this image
Graphics g = trans.getGraphics();
<redraw image substituting transparentfor bg>
}
I need to know how to do the <>. My most obvious response would be to go though the Image's array of colors (the way an Image is stored) and change the "bg" color to transparent. But that brings up two questions. (a) Is it possible to access and change that array, and (b) What is the "transparent color" and can the Color object hold it?
If anyone can answer this question or has another algorithm, I am offering "duke dollars" for this.

