<meta http-equiv="content-type" content="text/html; charset=utf-8"><div class="gmail_quote">On Thu, Jun 16, 2011 at 5:01 AM, Leguay Romain <span dir="ltr"><<a href="mailto:romain.leguay@etu.u-bordeaux1.fr">romain.leguay@etu.u-bordeaux1.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello everyone!<br>
I want to do a screenshot of my scene. To do this I follow the example <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/Screenshot" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/Screenshot</a>.<br>
For information, I work on a java project.<br>
My application closes itself without errors.<br>
I send you my code:<br>
<br>
public void saveScreenshot(String fileName) {<br>
<br>
vtkWindowToImageFilter windowToImageFilter = new vtkWindowToImageFilter();<br>
windowToImageFilter.SetInput(fr.cea.visualization.renderer.Activator<br>
.getDefault().getRenderer().getPanel().GetRenderWindow());<br>
windowToImageFilter.SetMagnification(magnification); //pour augmenter la résolution<br>
windowToImageFilter.SetInputBufferTypeToRGBA(); //pour lire toutes les composantes couleurs<br>
<br>
windowToImageFilter.Update(); // <<<<----- when I launch the Update method, nothing appends and my application closes itself<br>
<br>
switch (type) {<br>
case JPEG:<br>
vtkJPEGWriter jpegWriter = new vtkJPEGWriter();<br>
jpegWriter.SetFileName(fileName);<br>
jpegWriter.SetInput(windowToImageFilter.GetOutput());<br>
jpegWriter.Write();<br>
break;<br>
case PNG:<br>
vtkPNGWriter pngWriter = new vtkPNGWriter();<br>
pngWriter.SetFileName(fileName);<br>
pngWriter.SetInput(windowToImageFilter.GetOutput());<br>
pngWriter.Write();<br>
break;<br>
default:<br>
return;<br>
}<br>
}<br>
<br>
I don't understand why this code doesn't work.<br>
Has anyone got any ideas?<br>
<br>
Thanks,<br>
Romain<br></blockquote><div><br></div><div>Did you see the Java section of the examples?</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://www.vtk.org/Wiki/VTK/Examples/Java/Miscellaneous/Screenshot">http://www.vtk.org/Wiki/VTK/Examples/Java/Miscellaneous/Screenshot</a><br clear="all">
<br><div>David </div></div>