[vtk-developers] Actor2D, subclasses and imagemappers
John Biddiscombe
jbiddiscombe at skippingmouse.co.uk
Sun Nov 19 14:53:13 EST 2000
Notes on some changes recently checked in...
I wanted to make some changes to the image mappers : viz - displaying an
image into a customized "region" of the screen - 2D plot. I tried several
approaches but finally decided that Actor2D needed a position2Coordinate.
Most of the subclasses use one anyway.
I've moved Position2Coordinate into Actor2D and removed it from
vtkLegendBoxActor
vtkXYPlotActor
vtkParallelCoordinatesActor
vtkScalarBarActor
vtkScaledTextActor
but for reasons of its own, vtkAxisActor2D has renamed the position
coordinates to Point1 and Point2 and rather than break anything, I've left
them alone. (Anyone want to change them to position1 and 2?)
vtkImageMapper now has a new option
RenderToRectangle
which is implemented in
vtkWin32ImageMapper : Use StretchBlt(...)
vtkOpenGLImageMapper : use glPixelZoom(x,y)
it takes the screen region from the Actor's position coordinates
but there are a couple of other image mappers (Mesa + X) which I haven't
touched because I'm not expert at them. I'm guessing its straightforward to
modify them too, but for now the new functions are not implememented.
I've also added another option
CustomDisplayExtent
because I want to zoom in on particular parts of the image and not display
using the whole extents. I had to bypass some code in the imagemapper to
achieve this as it was setting the displayextent to the whole extent every
time. The new option does this cleanly.
Also I added some code to map scalars into a lookup table under win32 for
those of us who don't want greyscale images when there's just one scalar
component. I'm going to add it to OpenGLImageMapper too (but see below).
I've now moved the lookuptable to imagemapper base class and am going to
update the others...
I have some outstanding issues :
The code for converting an imagedata object into an "image" appears to be
duplicated in different image mappers. They all do basically the same
thing. Shift and scale the image and create either rgb/rgba or char arrays.
Is there any difference? (I'm still wading through it all looking for
subtle differences, but I suspect they're the same really). I feel these
could all be collected into imagemapper base class and accessed cleverly to
ensure the correct format is created. At the same time, I could unify the
LookupTable mapping so it can be used whenever a greyscale image would
normally be created.
OpenGlImageMapper doesn't cache its image! really? Seems odd. why not?
Shall I fix this by adding an "immediatemode rendering" type flag. The
Win32ImageMapper, by default, caches the HBItmap object so I don't see why
OpenGL shouldn't too. Adding a flag to control whether the image is
computed, then saved, or recomputed every time makes sense.
It looks as though someone has made a start on adding various features in
the past, but never finished. I need to tidy up some issues such as the
clipping which may be buggy now that I've added the new rectangle
functions. I await bug reports.
Does anyone have strong feeling about these points/comments? Adding the new
functions has enabled me to display 2D images very nicely into small
windows and zoom in onto just a few pixels blown right up (with contours
overlaid etc, which is what I wanted - c.f GIS stuff).
ttfn
JB
PS. I'm about to do a couple of new tcl regression tests, but am still
unsure about checking in valid images. Also
More information about the vtk-developers
mailing list