Hi,
Im writing a small game in java (applet) and I am using 66x66 tiles saved as .png. I load the images as Image objects using getImage(), and then I create BufferedImage objects from them using the code below. The problem is I cant get the BufferedImage objects to render properly; they just show all black. The original Image objects, however, always render properly. Its driving me crazy. Here is the code snippet I use to create the BufferedImage objects:
//assume Image origImage exists
BufferedImage bImage = new BufferedImage(66,66,BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = bImage.createGraphics();
g2.drawImage(origImage,0,0,this);
I then render the BufferedImage objects in the normal fashion:
public void paint(Graphics g){
Graphics2D g2 = (Graphics2D)g;
g2.drawImage(bImage,x,y,this);
}
Any help would be much appreciated. Also, I have tried every single combination of BufferedImage type. Im not saying this couldnt be the problem, but, well, you know.
Thanks...
Im writing a small game in java (applet) and I am using 66x66 tiles saved as .png. I load the images as Image objects using getImage(), and then I create BufferedImage objects from them using the code below. The problem is I cant get the BufferedImage objects to render properly; they just show all black. The original Image objects, however, always render properly. Its driving me crazy. Here is the code snippet I use to create the BufferedImage objects:
//assume Image origImage exists
BufferedImage bImage = new BufferedImage(66,66,BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = bImage.createGraphics();
g2.drawImage(origImage,0,0,this);
I then render the BufferedImage objects in the normal fashion:
public void paint(Graphics g){
Graphics2D g2 = (Graphics2D)g;
g2.drawImage(bImage,x,y,this);
}
Any help would be much appreciated. Also, I have tried every single combination of BufferedImage type. Im not saying this couldnt be the problem, but, well, you know.
Thanks...