Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
cristisor
Posts: 48
Registered: ‎07-15-2009
My Device: Not Specified
Accepted Solution

Semi-transparency on Storm

Hi,

Does the Storm or any other BB device support semi-transparency? I have an image when when this image is touched I want to paint a semi-transparent image on top so that the user will understand that the event happened.

Please use plain text.
Developer
paulhaenel
Posts: 220
Registered: ‎09-09-2008
My Device: Bold 9780
My Carrier: Telstra AU

Re: Semi-transparency on Storm

Yes sure you can do that all you need to do is paint the right elements in the right order :smileyhappy:....

 

if you dont know how to paint things to an element with tranpaent background check out the following in the Graphics API

     

     setGlobalAlpha(int alpha) 

          Sets the current global alpha value for drawing operations. 

 

Paul 

-----------

Follow me on twitter: twitter.com/paul.haenel

If your issue is resolved, please mark this thread as solved.

Set the "Solution" mark on the post which contains the answer to your question.
Please use plain text.
Developer
cristisor
Posts: 48
Registered: ‎07-15-2009
My Device: Not Specified

Re: Semi-transparency on Storm

So let's suppose that I have an image with a break pedal an another image with the same pedal but semi-transparent. And when the pedal is touched I want to draw the semi-transparent pedal.Should it be like this?

 

if (drawTransparent) { g.setGlobalAlpha(0); g.drawBitmap(x, y, pedal.getWidth(), pedal.getHeight(), pedal, 0, 0); gm.newSelectedMenu = -1; g.setGlobalAlpha(255); }

 

How much should I set the global alpha? And after I make the paint should I reset the value to 255 or should I use g.popContext? I'm asking this because in the API documention it says: "Global alpha is stored on the stack so popContext will restore it to the previous value."

 

Please use plain text.
Developer
paulhaenel
Posts: 220
Registered: ‎09-09-2008
My Device: Bold 9780
My Carrier: Telstra AU

Re: Semi-transparency on Storm

hey ur sample looks right i would just get the globalAlpha value before you change it and then set it back after u made the change.

 

to what value u should set globalAlpha to is depending on the design of you application. In one of my application i use 100.

 

Hope this helps.... 

 

Paul 

 

PS; Please mark the thread as solved once it has been .... 

-----------

Follow me on twitter: twitter.com/paul.haenel

If your issue is resolved, please mark this thread as solved.

Set the "Solution" mark on the post which contains the answer to your question.
Please use plain text.
Developer
cristisor
Posts: 48
Registered: ‎07-15-2009
My Device: Not Specified

Re: Semi-transparency on Storm

Yes, it solved my problem. Thanks.
Please use plain text.