Public Member Functions | Private Member Functions | Private Attributes
vgui_vil_image_renderer Class Reference

OpenGL utility to render a vil_image_view. More...

#include <vgui_vil_image_renderer.h>

List of all members.

Public Member Functions

 vgui_vil_image_renderer ()
 Constructor - create an empty image renderer.
 ~vgui_vil_image_renderer ()
 Destructor - delete image buffer.
void set_image_resource (vil_image_resource_sptr const &)
 Attach the renderer to a new view.
vil_image_resource_sptr get_image_resource () const
 Return the image resource that this renderer draws.
void reread_image ()
 Tell the renderer that the underlying image data has been changed.
void render (vgui_range_map_params_sptr const &mp)
 Renders the image pixels. If mp not null then render over an interval.

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.
bool render_directly (vgui_range_map_params_sptr const &mp)
 Render the pixels in hardware using the glPixelMap with range_map data.
void create_buffer (vgui_range_map_params_sptr const &rmp)
 Create a buffer if necessary.
void create_buffer (vgui_range_map_params_sptr const &rmp, unsigned x0, unsigned y0, unsigned x1, unsigned y1, float zoomx, float zoomy)
 Create a buffer with viewport dimensions.
void create_buffer (vgui_range_map_params_sptr const &rmp, float zoomx, float zoomy, vil_image_resource_sptr const &ir)
 Create a buffer from specified resource corresponding to a pyramid zoom level.
void draw_pixels ()
 draw the pixels to the frame buffer.

Private Attributes

vil_image_resource_sptr the_image_
 Stores the image data (pixels, dimensions, etc).
vgui_section_bufferbuffer_
 Stored the GL pixels corresponding to the image data.
vgui_range_map_params_sptr buffer_params_
 a cache for the range map params associated with buffer.
bool valid_buffer_
 buffer state variable.
vil_memory_chunk_sptr vbuf_
 a cache when rendering using the gl hardware map.
unsigned x0_
unsigned y0_
unsigned w_
unsigned h_
float zx_
float zy_
unsigned sni_
unsigned snj_

Detailed Description

OpenGL utility to render a vil_image_view.

This is not a tableau.

The vil_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 vil_image_resource (as given) The image is rendered by extracting appropriate views from the resource There are different modes of rendering based on flags set on the vgui_range_map_params range mapping class. The states are:

1) rmp == null - a buffer is created for the entire image and the buffer supplies glPixels to the display. Range map tables are used where appropriate. No pyramid image support

2) rmp->use_glPixelMap && rmp->cache_mapped_pix pyramid images are handled properly and the range maps are used to generate the scaled pyramid view buffer. gl hardware maps are not used. gl pixels are generated in software using the maps. Rendering is limited to the current viewport. The buffer is updated only if the viewport changes

3) rmp->use_glPixelMap && !rmp->cache_mapped_pix pyramid images are handled properly and the range maps are loaded into gl hardware for rendering. The pyramid image data that drives the hardware is cached as a memory_chunk, but not a pre-mapped glPixel buffer as in 2). The memory_chunk is only updated if the viewport changes.

Definition at line 59 of file vgui_vil_image_renderer.h.


Constructor & Destructor Documentation

vgui_vil_image_renderer::vgui_vil_image_renderer ( )

Constructor - create an empty image renderer.

Definition at line 33 of file vgui_vil_image_renderer.cxx.

vgui_vil_image_renderer::~vgui_vil_image_renderer ( )

Destructor - delete image buffer.

Definition at line 41 of file vgui_vil_image_renderer.cxx.


Member Function Documentation

void vgui_vil_image_renderer::create_buffer ( vgui_range_map_params_sptr const &  rmp) [private]

Create a buffer if necessary.

Definition at line 79 of file vgui_vil_image_renderer.cxx.

void vgui_vil_image_renderer::create_buffer ( vgui_range_map_params_sptr const &  rmp,
unsigned  x0,
unsigned  y0,
unsigned  x1,
unsigned  y1,
float  zoomx,
float  zoomy 
) [private]

Create a buffer with viewport dimensions.

creates a buffer for a portion of the image.

Definition at line 108 of file vgui_vil_image_renderer.cxx.

void vgui_vil_image_renderer::create_buffer ( vgui_range_map_params_sptr const &  rmp,
float  zoomx,
float  zoomy,
vil_image_resource_sptr const &  ir 
) [private]

Create a buffer from specified resource corresponding to a pyramid zoom level.

Definition at line 122 of file vgui_vil_image_renderer.cxx.

void vgui_vil_image_renderer::draw_pixels ( ) [private]

draw the pixels to the frame buffer.

Definition at line 142 of file vgui_vil_image_renderer.cxx.

vil_image_resource_sptr vgui_vil_image_renderer::get_image_resource ( ) const

Return the image resource that this renderer draws.

Definition at line 63 of file vgui_vil_image_renderer.cxx.

bool vgui_vil_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 469 of file vgui_vil_image_renderer.cxx.

void vgui_vil_image_renderer::render ( vgui_range_map_params_sptr const &  mp)

Renders the image pixels. If mp not null then render over an interval.

Definition at line 445 of file vgui_vil_image_renderer.cxx.

bool vgui_vil_image_renderer::render_directly ( vgui_range_map_params_sptr const &  mp) [private]

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 149 of file vgui_vil_image_renderer.cxx.

void vgui_vil_image_renderer::reread_image ( )

Tell the renderer that the underlying image data has been changed.

Definition at line 71 of file vgui_vil_image_renderer.cxx.

void vgui_vil_image_renderer::set_image_resource ( vil_image_resource_sptr const &  image)

Attach the renderer to a new view.

Definition at line 48 of file vgui_vil_image_renderer.cxx.


Member Data Documentation

Stored the GL pixels corresponding to the image data.

Definition at line 89 of file vgui_vil_image_renderer.h.

a cache for the range map params associated with buffer.

Definition at line 92 of file vgui_vil_image_renderer.h.

unsigned vgui_vil_image_renderer::h_ [private]

Definition at line 100 of file vgui_vil_image_renderer.h.

unsigned vgui_vil_image_renderer::sni_ [private]

Definition at line 102 of file vgui_vil_image_renderer.h.

unsigned vgui_vil_image_renderer::snj_ [private]

Definition at line 102 of file vgui_vil_image_renderer.h.

Stores the image data (pixels, dimensions, etc).

Definition at line 86 of file vgui_vil_image_renderer.h.

buffer state variable.

Definition at line 95 of file vgui_vil_image_renderer.h.

a cache when rendering using the gl hardware map.

Definition at line 98 of file vgui_vil_image_renderer.h.

unsigned vgui_vil_image_renderer::w_ [private]

Definition at line 100 of file vgui_vil_image_renderer.h.

unsigned vgui_vil_image_renderer::x0_ [private]

Definition at line 100 of file vgui_vil_image_renderer.h.

unsigned vgui_vil_image_renderer::y0_ [private]

Definition at line 100 of file vgui_vil_image_renderer.h.

Definition at line 101 of file vgui_vil_image_renderer.h.

Definition at line 101 of file vgui_vil_image_renderer.h.


The documentation for this class was generated from the following files: