I just tried your code and it worked as expected (under Mac OS X). You don't need to create the BufferedImage instance, and you can call create getOffScreenImage directly, as shown in this test case:
public class Export3DViewToPNG {
public static void main(String [] args) throws RecorderException, IOException {
Home home = new HomeFileRecorder().readHome("test.sh3d");
HomeComponent3D homeComponent3D = new HomeComponent3D(home);
BufferedImage image = homeComponent3D.getOffScreenImage(400, 400);
File file = new File("tmp.png");
ImageIO.write(image, "png", file);
}
}
I just tried your code and it worked as expected (under Mac OS X). You don't need to create the BufferedImage instance, and you can call create getOffScreenImage directly
True, it works fine. It was a permissions problem with windows vista. Thanks for tip, i'm just a java newbie. I hope this changes in the future