[vtkusers] vtkWindowToImageFilter problem

Leguay Romain romain.leguay at etu.u-bordeaux1.fr
Thu Jun 16 07:57:40 EDT 2011


 
Le Jeudi 16 Juin 2011 13:05 CEST, David Doria <daviddoria at gmail.com> a écrit: 
 
> 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
 
 Hi David!
Thanks for your answer.
I see this example and I don't find any differences between exemple code and mine. I don't use a vtkRenderWindow to display my scene but a vtkCanvas: can it be a problem?

Regards,
Romain


 
 




More information about the vtkusers mailing list