[vtkusers] vtkWindowToImageFilter problem
David Doria
daviddoria at gmail.com
Thu Jun 16 07:05:40 EDT 2011
On Thu, Jun 16, 2011 at 5:01 AM, Leguay Romain <
romain.leguay at etu.u-bordeaux1.fr> wrote:
> Hello everyone!
> I want to do a screenshot of my scene. To do this I follow the example
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/Screenshot.
> For information, I work on a java project.
> My application closes itself without errors.
> I send you my code:
>
> public void saveScreenshot(String fileName) {
>
> vtkWindowToImageFilter windowToImageFilter = new
> vtkWindowToImageFilter();
>
> windowToImageFilter.SetInput(fr.cea.visualization.renderer.Activator
>
> .getDefault().getRenderer().getPanel().GetRenderWindow());
> windowToImageFilter.SetMagnification(magnification); //pour
> augmenter la résolution
> windowToImageFilter.SetInputBufferTypeToRGBA(); //pour lire
> toutes les composantes couleurs
>
> windowToImageFilter.Update(); // <<<<----- when I launch the
> Update method, nothing appends and my application closes itself
>
> switch (type) {
> case JPEG:
> vtkJPEGWriter jpegWriter = new vtkJPEGWriter();
> jpegWriter.SetFileName(fileName);
>
> jpegWriter.SetInput(windowToImageFilter.GetOutput());
> jpegWriter.Write();
> break;
> case PNG:
> vtkPNGWriter pngWriter = new vtkPNGWriter();
> pngWriter.SetFileName(fileName);
> pngWriter.SetInput(windowToImageFilter.GetOutput());
> pngWriter.Write();
> break;
> default:
> return;
> }
> }
>
> I don't understand why this code doesn't work.
> Has anyone got any ideas?
>
> Thanks,
> Romain
>
Did you see the Java section of the examples?
http://www.vtk.org/Wiki/VTK/Examples/Java/Miscellaneous/Screenshot
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110616/2c148be8/attachment.htm>
More information about the vtkusers
mailing list