Better management of transparency in SWIG Java bindings
|Reported by:||danieleromagnoli||Owned by:||Even Rouault|
This is a proposal to improve the transparency management when generating JAVA Bindings: Actually, the bindings allow to return an IndexColorModel from a GDALColorTable. http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/IndexColorModel.html
However, there isn't special management for cases where there is only a single fully transparent alpha element or cases where all pixels are opaque.
The proposed patch allows to setup an IndexColorModel with the following set of rules:
- If the ColorTable contains N elements and all the elements are opaques, then setup a simple IndexColorModel with R,G,B entries.
- Else, if the ColorTable contains N elements where N-1 elements are fully opaque and only a single one has alpha == 0 (fully transparent), then setup an IndexColorModel where you specify the index in the table of the unique transparent pixel.
- Else (there are several alpha pixels with different opacity) setup an IndexColorModel with R,G,B,Alpha entries.
Can you please review that patch and apply it if ok?