| synopsis || arguments || prev |

kdu_region_compositor::paint_overlay

Java: Kdu_region_compositor::Paint_overlay

virtual void paint_overlay( kdu_uint32 * buffer, kdu_dims buffer_region, int buffer_row_gap, kdu_dims bounding_region, int codestream_idx, jpx_metanode node, int painting_param, kdu_coords image_offset, kdu_coords subsampling, bool transpose, bool vflip, bool hflip, kdu_coords expansion, kdu_coords compositing_offset)

Java: void Paint_overlay( long[] buffer, Kdu_dims buffer_region, int buffer_row_gap, Kdu_dims bounding_region, int codestream_idx, Jpx_metanode node, int painting_param, Kdu_coords image_offset, Kdu_coords subsampling, boolean transpose, boolean vflip, boolean hflip, Kdu_coords expansion, Kdu_coords compositing_offset)

[Declared in "../apps/support/kdu_region_compositor.h"]

Go to class description.


Synopsis

This function is called from the internal machinery whenever the overlay for some spatially sensitive metadata needs to be painted. The default implementation simply paints a shaded box into the relevant region of the overlay buffer. More sophisitcated implementations may override this function to paint more interesting overlays, possibly incorporating text labels.

The buffer argument provides the upper left hand corner of a raster scan overlay buffer, which represents the entire buffered area associated with a particular codestream. For reliable behaviour, you should confine your painting to the supplied bounding_region. The reason for this is that anything painted outside this region might not be correctly erased or repainted as the associated metadata region moves onto and off the overlay buffer surface (due to user panning, for example).

While detailed descriptions of the various arguments appear below, it is worth describing the geometric mapping process up front. Region sensitive metadata is always associated with specific codestreams, via an ROI description box. The ROI description box describes the regions on the codestream's high resolution canvas, with locations offset relative to the upper left hand corner of the image region on this canvas (the image region might not necessarily start at the canvas origin). By contrast, the overlay buffer's coordinate system is referred to a compositing reference grid, which depends upon compositing instructions in the JPX data source, as well as the current scale and orientation of the rendering surface. To map from an ROI description region, R, to the compositing reference grid, the following steps are required:


Arguments

buffer [kdu_uint32 *]

Points to the upper left hand corner of the current overlay buffer. The size and organization of this buffer are described by the buffer_region and buffer_row_gap arguments. The overlay buffer has alpha, R, G and B components and is alpha blended with the image component associated with this overlay. When painting the buffer, it is your responsibility to write alpha, R, G and B values at each desired location. You are not responsible for performing the alpha blending itself. The organization of the four channels within each 32-bit word is as follows:

buffer_region [kdu_dims]

Region occupied by the overlay buffer, expressed on the compositing reference grid. See the description of region mapping conventions in the introduction to this function.

buffer_row_gap [int]

Separation between vertically adjacent entries in the buffer array.

bounding_region [kdu_dims]

Bounding rectangle, containing all of the regions described by the ROI description box associated with node. This bounding rectangle is not necessarily fully contained within the buffer_region, but they should intersect. It uses the same coordinate system as buffer_region — i.e., the compositing reference grid, as opposed to the codestream canvas.

codestream_idx [int]

Identity of the codestream with which this overlay is associated. Each overlay is associated with exactly one codestream, since region-specific metadata is always registered against the canvas of some codestream.

node [jpx_metanode]

This is guaranteed to represent an ROI description box. Use the jpx_metanode::get_regions member (for example) to recover the geometrical properties of the region. Use other jpx_metanode members to examine any descendant nodes, describing metadata which is associated with this spatial region. A typical implementation might look for label boxes, XML boxes or UUID boxes (with associated URL's) in the descendants of node.

painting_param [int]

This is a copy of the parameter supplied in the most recent call to configure_overlays. Your implementation may use this parameter to adjust the appearance of the overlay image.

image_offset [kdu_coords]

See the 5 coordinate transformation steps described in the introduction to this function.

subsampling [kdu_coords]

See the 5 coordinate transformation steps described in the introduction to this function.

transpose [bool]

See the 5 coordinate transformation steps described in the introduction to this function.

vflip [bool]

See the 5 coordinate transformation steps described in the introduction to this function.

hflip [bool]

See the 5 coordinate transformation steps described in the introduction to this function.

expansion [kdu_coords]

See the 5 coordinate transformation steps described in the introduction to this function.

compositing_offset [kdu_coords]

See the 5 coordinate transformation steps described in the introduction to this function.


| top || synopsis || arguments || prev |