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

Posts: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

how to draw the image in the paint method?

Hi,i want to draw a image using paint method,i prefered to take the image as Bitmap

Is there any ways to take the  image as EncodedImage ,so that i can resize it.


similarly how to  convert the bitmap to encodedimage.





Rakesh Shankar.P

Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-, Z10 (STL100-3)-, Z30 (STA100-5)-, Passport (SQW100-1)-, PlayBook (16GB)-
My Carrier: Verizon

Re: how to draw the image in the paint method?

You have to re-encode it since EncodedImage only takes formats like PNG, JPEG, etc. for input.


Take a look at some of the specific EncodedImage classes because some have a function that can encode raw RGB to an EncodedImage for you (such as JPEGEncodedImage).


Your other option is to make your own encoder or find one (one popular one, if you search the forums for it, is a PNG encoder which works very well).

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.