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!

