[vtkusers] printig a VTK window in wxWindows
prabhu at aero.iitm.ernet.in
Thu Sep 20 01:28:40 EDT 2001
>>>>> "choni" == choni <choni at adinet.com.uy> writes:
choni> Has anybody tried to print a vtk image from a wxWindows
choni> window? Any help regarding this subject will be
If by print you mean dump screen to an image, yes, this can be easily
done. I have done this for wxPython an the code should be somewhat
similar for wxWindows.
Use one of the following (this is all python code so you will need to
translate it a little to c++).
# save as PPM
# save as BMP
w2if = vtkWindowToImageFilter()
ex = vtkBMPWriter()
You could use a whole bunch of writers instead of the vtkBMPWriter -
vtkTIFFWriter, vtkPNGWriter (new in VTK 4 CVS tree), vtkJPEGWriter
(also new in VTK 4.0 CVS tree), etc.
There is one thing you need to remember, you have to raise the VTK
window that is rendering the scene to the top - I do this by obtaining
the top level window and then invoking Raise() on it followed by a
wxYield() and then do a renwin.Render(). On UNIX if you dont raise
the window to the top with other windows obscuring it, the image you
get will be exactly what you see with all the other windows obscuring
I hope this makes sense.
More information about the vtkusers