Opened 4 years ago

Closed 3 years ago

#5107 closed defect (fixed)

Android Swig for Java fix

Reported by: jaakl Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: svn-trunk
Severity: normal Keywords: android
Cc:

Description

Swig .i file for GDAL refers to awt Color object which is not available for Android. I replaced it with int which is used in Android for color (ARGB), and then it is usable for Android. The result file is attached as hotfix.

A smarter .i file would be beter, which makes different API for desktop Java and Android, or simply use int-based color everywhere, as you can quite simply reconvert int in desktop java.

Source: https://github.com/nutiteq/gdal/wiki/AndroidHowto

Attachments (1)

typemaps_java.i (52.3 KB) - added by jaakl 4 years ago.

Download all attachments as: .zip

Change History (6)

Changed 4 years ago by jaakl

Attachment: typemaps_java.i added

comment:1 Changed 4 years ago by Even Rouault

I've tried your version, but it doesn't appear to be sufficient to make compilation work. I have compilation failures due to public IndexColorModel? getIndexColorModel(int bits) defined in swig/include/java/gdal_java.i. I don't understand why it would work for you if you don't change that file too.

comment:2 Changed 4 years ago by jaakl

Yes, I had to removed this IndexColorModel? method definition from gdal_java.i together with imports import java.awt.image.IndexColorModel?; import java.awt.Color;

comment:3 Changed 4 years ago by jaakl

There seems to be no java.awt.image.IndexColorModel? analog in Android, and I did not really need it (or know I needed it) to decode images, so removal made sense.

comment:4 Changed 4 years ago by Even Rouault

trunk r26068 "Java bindings: run 'make ANDROID=yes' in swig/java to generate SWIG bindings that compile for Android (java.awt.Color replaced by int, ColorTable?.getIndexColorModel() removed (#5107)"

comment:5 Changed 3 years ago by Even Rouault

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.