Saving an image from a Canvas
Hello,
I'm a beginner. I've created an application wich uses a native procedure, myFunc(), wich paints an image over a Canvas.
But now I want to create an Image from each frame that is painted over this Canvas. The paint method is like this one:
publicvoid paint(Graphics g){
Rectangle r = this.getBounds();
Image image = this.createImage(r.width, r.height);
Graphics g = image.getGraphics();
this.paint(g);
try{
ImageIO.write((RenderedImage)image,"png",new File(name));
}catch(IOException ioe){
// ...
}
}
It works, but it just saves a gray image, such if no image were rendered to the Canvas. What's going wrong? Thank you

