[vtkusers] vtkWindowToImageFilter

zx_sanjin at 163.com zx_sanjin at 163.com
Tue Jan 16 02:00:11 EST 2007


hey all, 
I’m using the vtkWindowToImageFilter class for the screen shot to a image file. I used VS2005, vtk 4.1 under the windowXP. 

 

Here is my code: 

 

     vtkRenderWindow* pRenderWindow = pWindow->getRenderWindow();

 

     vtkWindowToImageFilter* pWindowToImageFilter = vtkWindowToImageFilter::New();

     pWindowToImageFilter->SetInput(pRenderWindow);

     pWindowToImageFilter->Update();

 

     vtkBMPWriter* pBMPWriter = vtkBMPWriter::New();

     pBMPWriter->SetInputConnection(pWindowToImageFilter->GetOutputPort());

     pBMPWriter->SetFileName("C:\\ExportRenderWindow2BMP.jpg");

 

     pRenderWindow->Render();

     pWindowToImageFilter->Modified();

pBMPWriter->Write();

 

When the render image size smaller than the screen size, in the other words, when you can see the whole image in the screen, these code work fine;

But, when the render image size bigger than the screen size, in the other words, after zoom in, when you can only see a part of the image, you can only get what you see, the saved image size is same to screen’s size. 

I want to get the whole image data to image file, who can help me, thanks for any advice!

 

 

 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070116/2e4af875/attachment.htm>


More information about the vtkusers mailing list