Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#3455 closed enhancement (fixed)

Better management of transparency in SWIG Java bindings

Reported by: danieleromagnoli Owned by: Even Rouault
Priority: normal Milestone: 1.7.2
Component: JavaBindings Version: 1.7.1
Severity: normal Keywords:
Cc:

Description

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?

Attachments (1)

gdal1.7.1.patch (1.5 KB ) - added by danieleromagnoli 14 years ago.

Download all attachments as: .zip

Change History (4)

by danieleromagnoli, 14 years ago

Attachment: gdal1.7.1.patch added

comment:1 by Even Rouault, 14 years ago

Milestone: 1.7.21.8.0
Resolution: fixed
Status: newclosed

Applied in trunk (r19007). Thanks

comment:2 by danieleromagnoli, 14 years ago

Could be possible to include that patch on the 1.7.X branch (to be included in the next 1.7 releases)?

comment:3 by Even Rouault, 14 years ago

Milestone: 1.8.01.7.2

We usually don't backport enhancements into stable branches, but it doesn't seem too risky and you provided the patch ;-), I commited it in r19012 in branches/1.7

It was just a performance enhancement right ?

Note: See TracTickets for help on using tickets.