| synopsis || arguments || prev || next |
void set_chroma_key( int colour_idx, kdu_int32 key_val)
Java: void Set_chroma_key( int colour_idx, int key_val)
[Declared in "../apps/compressed_io/jp2.h"]
You may use this function to specify a chroma key. Any pixel whose colour matches the chroma key exactly is understood to be fully transparent. Note carefully that many potential dangers exist with chroma keys. The main danger is that JPEG2000 code-streams are usually designed with lossy decoding in mind. Even if the original image is represented losslessly, truly lossless decoding may not be possible during interactive remote image browsing, until all data has been received from a server. Also, it is perfectly acceptable for a compliant decoder to discard some of the originally encoded data, resulting in a lossy rendition. Furthermore, reconstruction at reduced resolutions is a desirable capability for general purpose decoders, which generally prevents reliable recovery of chroma keys. Finally, unless the reversible processing path has been used, uncertainties on the order of a few digital counts typically arise as a result of numerical implementation differences between different compliant decoders.
For all of the above reasons, applications should be strongly discouraged from using this function. If it is used, the information must be recorded in a JPX "Opacity" (opct) box, which places restrictions on other component mapping possibilities. One immediate restriction is that you may not define opacity or pre-multiplied opacity channels in addition to the chroma key. If a chroma key value is defined for any one colour intensity channel, a chroma key value must be defined for all num_colours colour intensity channels, where num_colours is the value supplied to init.
Identifies the colour intensity channel whose chroma key is being supplied. The meaning of this argument is identical to that explained in connection with the set_colour_mapping function.
Defines the chroma key value. If the colour intensity channel is derived directly from an image component, the bit-depth and signed/unsigned properties of the chroma key value are those of the corresponding image component. If the colour intensity channel is derived from a palette LUT, the bit-depth and signed/unsigned properties of the chroma key value are those of the corresponding palette lookup table (see jp2_palette).