Ticket #3455 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Better management of transparency in SWIG Java bindings

Reported by: danieleromagnoli Owned by: 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

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

Change History

Changed 3 years ago by danieleromagnoli

Changed 3 years ago by rouault

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from 1.7.2 to 1.8.0

Applied in trunk (r19007). Thanks

Changed 3 years ago by danieleromagnoli

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

Changed 3 years ago by rouault

  • milestone changed from 1.8.0 to 1.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.