Preserve transparency when copying image

Hi,

I'm making a game applet inJava 1.1. To store my sprites I use gif pictures. The pictures have a transparent color (palette index 0). During the game I make a duplicate copy of the picture. This code shows what I'm doing:

Image img;

Image imgCopy;

Graphics imgCopyGraphics;

// load original image

img = getImage (getCodeBase (),"picture.gif");

while( img.getWidth(null) == -1 ){}

// init copy buffer

imgCopy = createImage (width, height);

imgCopyGraphics = imgCopy.getGraphics();

// make copy of img

imgCopyGraphics.drawImage (img,0,0,width,height ,0,0,width,height ,null);

My problem is that the transparency is lost when doing this, so when I draw the pictures to the screen, only the original picture (img) will draw with transparent edges, but not the copy (imgCopy).

Can somehelp help me how to copy the original image's palette to my second image? Thanks!

[1238 byte] By [DanTecha] at [2007-11-26 14:13:01]
# 1
Use BufferedImage with type BufferedImage.TYPE_INT_ARGB
Rodney_McKaya at 2007-7-8 2:01:53 > top of Java-index,Security,Cryptography...
# 2
> Use BufferedImage with type BufferedImage.TYPE_INT_ARGBThanks, but BufferedImage seems to be Java 1.2 and above. I need it to work on Java 1.1.
DanTecha at 2007-7-8 2:01:53 > top of Java-index,Security,Cryptography...