You Are Here:

Community: Developer Discussion Boards

#1 Old RE: Mutable images and transparency - 1970-01-01, 02:00

Join Date: Mar 2003
Posts: 9
done
Offline
Registered User
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
Reply With Quote

#2 Old Mutable images and transparency - 2002-10-13, 00:17

Join Date: Mar 2003
Posts: 12
Kiigan
Offline
Registered User
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 With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia