| synopsis || functions || variables |
[Declared in "../apps/support/kdu_region_decompressor.h"]
This structure provides all information required to express the relationship between code-stream image components and the colour channels to be produced during rendering. In the simplest case, each colour channel (red, green and blue, or luminance) is directly assigned to a single code-stream component. More generally, component samples may need to be mapped through a pallete lookup table, or a colour space transformation might be required (e.g., the components or palette outputs might describe the image in terms of a custom colour space defined through an ICC profile).
The purpose of this structure is to capture the reproduction functions required for correct colour reproduction, so that they can be passed to the kdr_region_decompressor::start function.
This structure also serves to capture any information concerning opacity (alpha) channels.
kdu_channel_mapping {Java: Kdu_channel_mapping}
~kdu_channel_mapping {Java: Native_destroy}
clear {Java: Clear}
configure (3 forms) {Java: Configure}
add_alpha_to_configuration {Java: Add_alpha_to_configuration}
get_num_channels {Java: Get_num_channels}
set_num_channels {Java: Set_num_channels}
get_num_colour_channels {Java: Get_num_colour_channels}
get_source_component {Java: Get_source_component}
get_colour_converter {Java: Get_colour_converter}
Total number of channels to render, including colour channels and opacity channels. The configure function will set this member to 1 or 3 if there is no alpha channel, and 2 or 4 if there is an alpha channel, depending on whether the source is monochrome or colour. However, you may manually configure any number of channels you like.
Indicates the number of initial channels which are used to describe pixel colour. This might be smaller than num_channels if, for example, opacity channels are to be rendered. All channels are processed in the same way, except in the event that colour space conversion is required.
Array holding the indices of the code-stream image components which are used to form each of the colour channels. There must be one entry for each channel, although multiple channels may reference the same source component. Also, the mapping between source component samples and channel sample values need not be direct.
Number of index bits used with any palette lookup tables found in the palette array.
Array with num_samples entries, each of which is either NULL or else a pointer to a lookup table with 2^{ palette_bits} entries.
Note carefully that each lookup table must have a unique buffer, even if all lookup tables hold identical contents. The buffer must be allocated using new, since it will automatically be de-allocated using delete when the present object is destroyed, or its clear function is called.
If palette_bits is non-zero and one or more entries in the palette array are non-NULL, the corresponding colour channels are recovered by scaling the relevant code-stream image component samples (see source_components) to the range 0 through 2^{ palette_bits}-1 and applying them (as indices) to the relevant lookup tables. If the code-stream image component has an unsigned representation (this is common), the signed samples recovered from kdu_synthesis or kdu_decoder will be level adjusted to unsigned values before applying them as indices to a palette lookup table.
The entries in any palette lookup table are 16-bit fixed point values, having KDU_FIX_POINT fraction bits and representing normalized quantities having the nominal range of -0.5 to +0.5.
Initialized to an empty interface ( colour_converter.exists returns false), you may call colour_converter.init to provide colour transformation capabilities. This object is used by reference within kdu_region_decompressor, so you should not alter its state while still engaged in region processing.