this should be an empty tranparent image. then i get the graphics context:
Graphics g = mutableImg.getGraphics();
and draw the loaded one to the new image:
g.drawImage(loadedImage, xOff, yOff, TOP|LEFT);
i used to test all that on the nokia 7210 device and the emulator and everything was fine.
but now while converting it to series 60 the resulting image is no longer transparent when using Graphics.drawImage. it has a black background. If i use DirectGraphics.drawImage the result is transparent, but this drawImage-method is much slower than the standard Graphics' image drawing method.
is there any other solution? is this only a series 60 problem or occurs this error also on a series 40 device?
Noticed that the Series 60s have Nokia UI 0.9.2 instead of the Nokia UI 1.0 that the 7210 emu has. It might be possible that only the newer phones and N-UI support a native Graphics::drawImage(...) transparency handling.
Another thing might be the shared/different bit depths of resource PNG files. I tried several combinations with no luck.
Its pretty annoying but only solutions seems to be using DirectGraphics all over...
At least some word from Nokia would solve the questioning.
if you load an image (transparent png) from a resource file and draw it with Graphics.drawImage everything is fine, only if you manipulate the image before using the nokia API then this possibility to draw the image gets lost. you have to use DirectGraphics then.
i've tested transparency on the following real devices (maybe it's interesting). you CAN manipulate images with the nokia UI API and then draw them with the standard Graphics-object WITHOUT transparency gets lost on the following series 40 devices:
i don't know if it's works on the other series 40 ones, because i didn't have the possibility to test it on them, but i think it will work on all series 40 devices.
definitely NOT working is it on the series 60 real devices:
I don't even get that to work. The transparency seems to get hopelessly lost when I make the image mutable, even if I use DirectGraphics to draw it. The following results in a white border where transparency should be. It's placed in the paint-handler..
Just throwing something out from the recesses of my memory (have the memory of a goldfish, by the way). I think I remember someone posting something on this board saying that the masking information was the other way around on the Series 60 - ie, someone has messed up.
So instead of [Image mutableImg = DirectUtils.createImage(w,h,0x00000000);]
You would try [Image mutableImg = DirectUtils.createImage(w,h,0xffffffff); ]
May be hogwash, but if someone wants to give it a go and let us know.