Original Post
Here's a quick JAVA 2D question. I'm running Wicket and want to dynamically generate/modify images sent to the browser. Wicket supplies the following method to override. However this doesn't display my PNG file with the surrounding transparency. All I get is a black rectangle. Help! Many Thanks Anthony
protected boolean render(Graphics2D graphics)
{
try {
BufferedImage image = ImageIO.read(new File("C:\\Projets\\randoweb\\src\\com\\tentelemed\\randoweb\\ui\\rando.png"));
BufferedImage bi= new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = bi.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
Rectangle2D.Double rect = new Rectangle2D.Double(0,0,32,32);
g2.fill(rect);
//g2.drawImage(image,0,0,null);
graphics.drawImage(bi, 0, 0, null);
} catch (Exception e) {
e.printStackTrace();
}
return true;
}