[vtkusers] how to render a bitmap file
Paul Cochrane
cochrane at esscc.uq.edu.au
Thu Mar 17 19:27:20 EST 2005
Try something like the following: (python code, will convert to C++/Tcl/Java
quite easily)
import vtk
# define the renderer and the render window
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
# use an interactive render window
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# set up the actor for the image
imgActor = vtk.vtkImageActor()
# read the bmp file
bmpReader = vtk.vtkBMPReader()
bmpReader.SetFileName("file.bmp")
imgActor.SetInput(bmpReader.GetOutput())
# add the actor to the renderer, add some settings to the render window
ren.AddActor(imgActor)
renWin.SetSize(400,400)
ren.SetBackground(0.1,0.2,0.4)
# render it!
iren.Initialize()
renWin.Render()
iren.Start()
HTH
Paul
* lufan (nns07 at 126.com) [050318 00:22]:
> vtkusers at vtk.org
>
> I wonder how to render a bitmap file,thanks
>
> lufan
> nns07 at 126.com
> 2005-03-17
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
--
Paul Cochrane
Computational Scientist/Software Developer
Earth Systems Science Computational Centre
University of Queensland
Brisbane
Queensland 4072
Australia
E: cochrane at esscc.uq.edu.au
P: +61 7 3346 9797
F: +61 7 3365 7347
More information about the vtkusers
mailing list