Transparent PNGs in MIDP1.0

Has anyone successfully used transparent images on a MIDP1.0 setup? I’ve tried it using the J2ME Wireless Toolkit 1.0.4_01, but to no avail. I don’t know whether it’s not supported (doc’s say it may or may not be, depending on the device) or if I’ve messed up creating the PNG file. My main interest is getting something going on the Palm emulator.

Cheers,
Mark

I don’t think any of Suns emulators support transparency, however most emulators from phone manufacturers (and there real phone counterparts) do support transparency.

I added

Enable transparent PNGs for sprites.

enablePNGtransparency=true

to the properties file of my testing device to activate it here.

[quote]I added

Enable transparent PNGs for sprites.

enablePNGtransparency=true

to the properties file of my testing device to activate it here.
[/quote]
only wtk2.0 MIDP 2.0 supports png transparencies…

to get via MIDP 1.0 you have to use your cell vendors api…

I added the line to my WTK 1.0.4 under Linux to make it work. I did not download WTK 2 yet, since it requires JDK 1.4 and I have only 1.3.

[quote]I added the line to my WTK 1.0.4 under Linux to make it work. I did not download WTK 2 yet, since it requires JDK 1.4 and I have only 1.3.
[/quote]
it still will not work wtk 1.04 is MIDP 1.0!

Jdk1.4 is aviable for linux through both blackdown and IBM-Jikes

You can only get trasnparency of PNG on MIDP 1.0 by using the closed source apis of the target device vendor… for example to get transparency of png on nokia phone syou have to use Nokia’s api…

What can I say. After adding the line here, my game had transparent sprites with WTK 1.0.4. I know for sure , since I especially had to add the line to make our current game work (we need transparency in our sprites). We don’t use any vendor specific APIs yet.

" it still will not work wtk 1.04 is MIDP 1.0!"

Easy there:)

We use WTK1.04, on purpse, because yes, it’s MIDP 1.0 and png transparency works. It’s supported on many MIDP 1.0 phones we have tried it on as well, without using any manufacturer or provider apis.

Bill

Transparent PNG support is optional in MIDP 1.0, and mandatory in MIDP 2.0. Most MIDP 1.0 phones support it (e.g. all of Nokia’s), and WTK 1.0.4 (for MIDP 1.0) supports it if you set that enablePNGtransparency setting daybyter mentions.

[quote]Transparent PNG support is optional in MIDP 1.0, and mandatory in MIDP 2.0. Most MIDP 1.0 phones support it (e.g. all of Nokia’s), and WTK 1.0.4 (for MIDP 1.0) supports it if you set that enablePNGtransparency setting daybyter mentions.
[/quote]
that only takes care of the emualtor…you have to use a closed source api from a device vendor to enable on the actual device!

It depends on the device, but in most cases (e.g. all Nokia MIDP 1.0 phones) PNG transparency is supported through the standard MIDP API. You don’t need any proprietary APIs to get transparent sprites.

The methods in question are in class:
javax.microedition.lcdui.Image
they are:
static Image createImage(String)
static Image createImage(byte[], int, int)
The first takes the name of a file in the MIDlet’s JAR file (e.g. “/rocket.png”, don’t forget that “/”); the second uses data from a byte array.

See the JavaDocs for class Image, and read the section titled PNG Image Format. The second bullet point ends with “Color types that include alpha channel data are supported; however, the implementation may ignore all alpha channel information and treat all pixels as opaque.” (My italics).

So, manufacturers can ignore the transparency information and create opaque Images from transparent PNGs, but they can also choose to interpret the transparency information and create transparent Images from transparent PNGs.

I’m not just talking theory here - I have personally written many MIDP 1.0 MIDlets with transparent sprites and run them successfully on several different Nokia MIDP 1.0 phones.

Yes, I can confirm this to be accurate. If you use the proper constructor - the vast majority of devices that DO support transparency (and not all of them do) will handle the transparency correctly. I haven’t run across any recent (last 12 month) devices that didn’t support transparency correctly, but some of the early MIDP devices seemed to have some problems with it.

[quote]that only takes care of the emualtor…you have to use a closed source api from a device vendor to enable on the actual device!
[/quote]
I’ll confirm with others… and what I tried to say above. It’s working on many 1.0 phones without special APIs! All Nokias I’ve tried (3650, 7650, 7210) and the Motorola i95cl work well. The Samsung A500 does not, which is a shame given that it has such a nice screen.

Bill

in midp1.0, png32 or png24 transparent is supported. In photoshop ImageReady7.0, create a transparent image, and save the image as png24 or png32 format, and transparent is supported. I have finish a game like this.