| Reply | « Previous Thread | Next Thread » |
|
I had the same problem, using com.nokia.mid.ui.DirectGraphics helped.
Image myImage = Image.createImage ("/blah.png"); Image mutableImage = Image.createImage (100, 100); Graphics gfx = mutableImage.getGraphics (); DirectGraphics dg = DirectUtils.getDirectGraphics(gfx); dg.drawImage (myImage, 0, 0, Graphics.TOP | Graphics.LEFT,0); ... //transparency is kept now, don't ask me why DirectGraphics dg = DirectUtils.getDirectGraphics(g); dg.drawImage (mutableImage, 0, 0, Graphics.TOP | Graphics.LEFT); hth, Dan |
|
Really simple question (I think):
I have a PNG which has a single index transparent colour (0xffffff). If I load the image and display it using Image.createImage(...) and Graphics.drawImage (...) it displays correctly (i.e. transparent, so the background is visible). e.g. Image myImage = Image.createImage ("/blah.png"); ... // this looks correct g.drawImage (myImage, 0, 0, Graphics.TOP | Graphics.LEFT); HOWEVER if I create a new mutable Image using Image.createImage (width, height) and then clip and draw portions from the immutable image into it, and then draw the new mutable image, I lose the transparency information i.e. I have a big white box around the image :) e.g. Image myImage = Image.createImage ("/blah.png"); Image mutableImage = Image.createImage (100, 100); Graphics gfx = mutableImage.getGraphics (); gfx.drawImage (myImage, 0, 0, Graphics.TOP | Graphics.LEFT); ... // this doesn't look correct g.drawImage (mutableImage, 0, 0, Graphics.TOP | Graphics.LEFT); Basically I'm writing a bitmap font system for a game menu, and I need a way to create mutable images containing menu elements (strings) that have been rendered. Is there a way to keep the transparency info, or to set it in the new mutable Image? thanks Ian |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|