Original Post
Hello all,
I''m writing a puzzle game that involves accumulating pieces onto a game board (think Tetris or Bubble Bobble). Currently, I''m using a function similar to the one below to generate the "pile" of pieces and draw it onto a bufferedImage. I then return the generated image and draw it to screen from within my paint method.
//the method
private Image generateLayer(int width, int height) {
BufferedImage bImage;
Graphics2D bg2;
bImage = (BufferedImage)createImage(width, height);
bg2 = bImage.createGraphics();
//generate "pile" here by drawing tiles to bImage
//with calls to bg2.drawImage()
return bImage;
}
I''ve encountered a problem with this technique: though the pile isn''t rectangular, the image returned by the function is. As a result, there''s an unsightly gray rectangle around the pile when I draw it over the background image.
I would like to be able to create a transparent buffer that I can draw arbitrary shapes onto, then blit that onto the final composite image.
Any suggestions on how to accomplish this, or on an alternative approach?
Many thanks,
*DiscoTurkey*