Skip to main content

How can I get Graphics with transparent background?

3 replies [Last post]
anupsth
Offline
Joined: 2009-05-21

I need to create icon by combining more than two icons.
Image img = Image.createImage(16, 16);
Graphics g = img.getGraphics();
I got Image with white background and going g.setAlpha(0) also didn't work.
I need to combine 3 icons(with transparent background) and set to Label. Is there any other way to do?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Shai Almog

This isn't supported by MIDP.
That is why we have isAlphaSupported which returns false for the plain
MIDP 2.0 implementation.
> I need to create icon by combining more than two icons.
> Image img = Image.createImage(16, 16);
> Graphics g = img.getGraphics();
> I got Image with white background and going g.setAlpha(0) also didn't work.
> I need to combine 3 icons(with transparent background) and set to Label. Is there any other way to do?
> [Message sent by forum member 'anupsth' (anupsth)]
>
> http://forums.java.net/jive/thread.jspa?messageID=347507
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Chen Fishbein

Hi,

Image.createImage(16, 16); creates opaque white image, see RGBImage for more flexibilities.

Regards,
Chen

RGBImage
lwuit-users@mobileandembedded.org wrote:
> I need to create icon by combining more than two icons.
> Image img = Image.createImage(16, 16);
> Graphics g = img.getGraphics();
> I got Image with white background and going g.setAlpha(0) also didn't work.
> I need to combine 3 icons(with transparent background) and set to Label. Is there any other way to do?
> [Message sent by forum member 'anupsth' (anupsth)]
>
> http://forums.java.net/jive/thread.jspa?messageID=347507
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

anupsth
Offline
Joined: 2009-05-21

getGraphics() is not allowed for RGBImage. Can you explain more please.