For a game I have created an VolatileImage as a backbuffer. I have tried to blit transparent gif images to this backbuffer and this works ok. The sprite is accelerated. When I try to create my own transparent BufferedImage the sprite works, but is not accelerated. I know that it can be done. So what im I doing wrong.
Below is the part of the code that blits the sprite to the backbuffer. the gif image is accelerated, but my own Image is not accelerated.
public class TestTransparent
{
private Image img = null;
/** Creates a new instance of TestTransparent */
public TestTransparent(GraphicsConfiguration graphConfig)
{
// img = Toolkit.getDefaultToolkit().getImage("G:\\trans.gif");
img = graphConfig.createCompatibleImage(400, 400, Transparency.BITMASK);
}
public void draw(Graphics g, int x, int y)
{
g.drawImage(img, x, y, null);
}
}