OpenGL utility to render a vil1_image. More...
#include <vgui_image_renderer.h>
Public Member Functions | |
vgui_image_renderer () | |
Constructor - create an empty image renderer. | |
~vgui_image_renderer () | |
Destructor - delete image buffer. | |
void | set_image (vil1_image const &) |
Attach the renderer to a new vil1_image. | |
vil1_image | get_image () const |
Return the vil1_image that this renderer draws. | |
void | reread_image () |
Tell the renderer that the underlying image has been changed. | |
void | render (vgui_range_map_params_sptr const &mp=0) |
Renders the image pixels. | |
bool | render_directly (vgui_range_map_params_sptr const &mp) |
Render the pixels in hardware using the glPixelMap with range_map data. | |
void | need_resection () const |
Not yet implemented - for future use. | |
Public Attributes | |
bool | use_texture_mapping |
Set this to true to use texture mapping for image rendering. | |
Private Member Functions | |
bool | old_range_map_params (vgui_range_map_params_sptr const &rmp) |
Are the range params those used to form the current buffer. | |
void | create_buffer (vgui_range_map_params_sptr const &rmp) |
Create a buffer if necessary. | |
void | draw_pixels () |
draw the pixels to the frame buffer. | |
Private Attributes | |
vil1_image | the_image |
vgui_section_buffer * | buffer |
vgui_range_map_params_sptr | buffer_params |
a cache for the range map params associated with buffer. | |
bool | valid_buffer |
buffer state variable. |
OpenGL utility to render a vil1_image.
This is not a tableau.
The image_renderer provides an easy way to render sections of an image. It should manage possibly sub-sampled buffers internally to provide a reasonable trade-off between memory consumption and rendering speed. For a very large image, which cannot be stored in core, locally panning the image should not be too slow because sections can be cached at various levels of resolution.
It is assumed that the image is located on the plane z=0 and that image pixel indices i,j (i is the column index, j the row index) describe the x,y-locations of the rendered pixels. It is currently undefined where the centre of a pixel is placed.
Note that the class keeps a vil1_image (as given), so if the underlying image is modified after sections have been taken by this class, inconsistent rendering may result. Call need_resection() to mark all previous sections as invalid.
Modifications J.L. Mundy - Dec 27 2004 added range map to control dynamic range of display
Definition at line 37 of file vgui_image_renderer.h.
vgui_image_renderer::vgui_image_renderer | ( | ) |
Constructor - create an empty image renderer.
Definition at line 24 of file vgui_image_renderer.cxx.
vgui_image_renderer::~vgui_image_renderer | ( | ) |
Destructor - delete image buffer.
Definition at line 31 of file vgui_image_renderer.cxx.
void vgui_image_renderer::create_buffer | ( | vgui_range_map_params_sptr const & | rmp | ) | [private] |
Create a buffer if necessary.
Definition at line 76 of file vgui_image_renderer.cxx.
void vgui_image_renderer::draw_pixels | ( | ) | [private] |
draw the pixels to the frame buffer.
Definition at line 90 of file vgui_image_renderer.cxx.
vil1_image vgui_image_renderer::get_image | ( | ) | const [inline] |
Return the vil1_image that this renderer draws.
Definition at line 75 of file vgui_image_renderer.h.
void vgui_image_renderer::need_resection | ( | ) | const |
Not yet implemented - for future use.
Definition at line 38 of file vgui_image_renderer.cxx.
bool vgui_image_renderer::old_range_map_params | ( | vgui_range_map_params_sptr const & | rmp | ) | [private] |
Are the range params those used to form the current buffer.
Are the range map params associated with the current buffer out of date?.
If so we have to refresh the buffer.
Definition at line 130 of file vgui_image_renderer.cxx.
void vgui_image_renderer::render | ( | vgui_range_map_params_sptr const & | mp = 0 | ) |
Renders the image pixels.
Definition at line 106 of file vgui_image_renderer.cxx.
bool vgui_image_renderer::render_directly | ( | vgui_range_map_params_sptr const & | mp | ) |
Render the pixels in hardware using the glPixelMap with range_map data.
Note that some OpenGL environments have no graphics hardware but the glPixelMap is still somewhat faster JLM (on a DELL precision)
Definition at line 96 of file vgui_image_renderer.cxx.
void vgui_image_renderer::reread_image | ( | ) |
Tell the renderer that the underlying image has been changed.
Tell the image renderer that the image has been changed, and should be re-read.
Definition at line 68 of file vgui_image_renderer.cxx.
void vgui_image_renderer::set_image | ( | vil1_image const & | image_ | ) |
Attach the renderer to a new vil1_image.
Definition at line 52 of file vgui_image_renderer.cxx.
vgui_section_buffer* vgui_image_renderer::buffer [private] |
Definition at line 50 of file vgui_image_renderer.h.
a cache for the range map params associated with buffer.
Definition at line 53 of file vgui_image_renderer.h.
vil1_image vgui_image_renderer::the_image [private] |
Definition at line 48 of file vgui_image_renderer.h.
Set this to true to use texture mapping for image rendering.
To succeed, it must be set before the first get_section()
is done on the image, i.e. before the first call to render() is made.
Definition at line 62 of file vgui_image_renderer.h.
bool vgui_image_renderer::valid_buffer [private] |
buffer state variable.
Definition at line 56 of file vgui_image_renderer.h.