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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 19
Registered: ‎07-26-2011
My Device: Storm 2 9550
My Carrier: GCI
Accepted Solution

How can I re size a bitmap while keeping my png's original transparency?

[ Edited ]

Greetings and salutations fellow developers,  some quick specifics, I use the blackberry JDE 5.0 and Eclipse.  I'm programming for multiple phones Storm2 and all Torch models.  The display area differs between a few of the phones from 480x360 to 800x480.

 

I have created a method for resizing images based on the aspect ratio here.

public static Bitmap AspectRatio(Bitmap bm)
	  {
		int widthRatio = (int)(360 / bm.getWidth());
		int width = (int)(Utility.SCREEN_WIDTH / widthRatio);
		int heightRatio = (int)(480 / bm.getHeight());
		int height = (int)(Utility.SCREEN_HEIGHT / heightRatio);
		Bitmap temp = new Bitmap(width, height);
		bm.scaleInto(temp, Bitmap.FILTER_BILINEAR);
		return temp;  
	  }

 

This method works great until I try it with my transparent Bitmaps.

 

The transparent part of my bitmaps are black and im not sure how to keep them trasparent.

Example below.

 

Before

X.png                    After

                    X2.png

 

 

How would I keep my opaqueness after stretching?

 

Thanks in advance.

 

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How can I re size a bitmap while keeping my png's original transparency?

Developer
Posts: 19
Registered: ‎07-26-2011
My Device: Storm 2 9550
My Carrier: GCI

Re: How can I re size a bitmap while keeping my png's original transparency?

[ Edited ]

 I did see that post I always try to make my own methods but this one is a bit above my head.  Thanks again Peter Smiley Happy -Andrew Mason