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
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810
Accepted Solution

multiset bitmaps - how to get part of a bitmap

Hi all.

Does anyone know how I could copy out a part of a bitmap? 

BB does it already. You can see it if you look at plazmic Kit resources. 

For instance, Radio strength indicator is an multiset png file, and when the strength changes, different part of a larger (mulitset) bitmap is displayed.

 

I tried doing something like that but run into a problem of converting a png to a byte[] (as can be seen on some forum threads, this is not very intuitive)

 

Currently I am stuck with the approach of loading the png through InputStreamReader.

But wouldn't it be simpler to reuse the (already loaded) Bitmap and just copy out the requested part ?

 

Has anyone have a deeper look into this ?



"Listen carefully, I shall say this only once"
Developer
Posts: 163
Registered: ‎07-16-2008
My Device: Not Specified
My Carrier: Sprint

Re: multiset bitmaps - how to get part of a bitmap

I'm not sure if I understand entirely what you mean, but you can use

 

 

public void drawBitmap(int x, int y, int width, int height, Bitmap bitmap, int left, int top)

 

 

 

 In this case, your bitmap would be the entire large image, and you'd use width, height, left, and top to paint only the portion of that bitmap that you want.

Andrew Cowart | Metova
www.metova.com
Highlighted
Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: multiset bitmaps - how to get part of a bitmap

That was exactly what I was trying to do!

 

Thank you for the hint.



"Listen carefully, I shall say this only once"