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
New Developer
Posts: 31
Registered: ‎09-24-2008
My Device: Not Specified

drawing EncodedImage

Hi friends,

 

I have an 3x3 matrix of EncodedImage and each image of size near about 5kb.

I draw these image in a for loop and the drawing of image take too much time.

 

I have to draw these image on every navigationMovement.

 

is there any solution to improve the speed of drawing EncodedImages.

 

or i have to use any other approch.

 

Thanks in advance

Ashish.

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

Re: drawing EncodedImage

How do you draw these?

 

Why do you need to redraw all of them?

 

Where does this drawing take place?

 

Do these images change?

New Developer
Posts: 31
Registered: ‎09-24-2008
My Device: Not Specified

Re: drawing EncodedImage

Thanks for quick reply..

 

i am drawing these images using

g.drawImage(x, y, width, height, image, 0, 0, 0);

 

its neccessory in myapplication to redraw images.

 

drawing part take place in paint method.

 

these images are come from server, first byte array converted in to EncodedImage and after all images are retrieved and then draw thsese images.

 

thanks

ashish.

Developer
Posts: 170
Registered: ‎01-17-2009
My Device: 9630

Re: drawing EncodedImage

Load the image in a constructor into a variable so that they aren't loaded from file everytime. This will help drastically if you aren't already doing this.
New Developer
Posts: 31
Registered: ‎09-24-2008
My Device: Not Specified

Re: drawing EncodedImage

Hi, already downloaded and created image before it going to paint on screen.

 

I want to konw that is there any approch to reduce the time taken by EncodedImage to draw on screen.

 

Thanks

ashish

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: drawing EncodedImage

Use "invalidate(x,y,width,height)" by specifying the only region which you want to paint.

Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 170
Registered: ‎01-17-2009
My Device: 9630

Re: drawing EncodedImage

What is the size of the image?
Developer
Posts: 86
Registered: ‎01-09-2009
My Device: Not Specified

Re: drawing EncodedImage

If you already have the image and time is your concern.  I would say load the image in a variable that is accessiable by your method earlier.  Or once you download the image, you can start a thread sperately to load the image so your current work wont get interrupted.
New Developer
Posts: 20
Registered: ‎07-21-2008
My Device: Not Specified

Re: drawing EncodedImage

It takes a lot more memory, but don't hold the EncodedImages in memory, hold them as Bitmaps instead.
New Developer
Posts: 31
Registered: ‎09-24-2008
My Device: Not Specified

Re: drawing EncodedImage

Hi guys for ur helps,

i have solved my problem.

 

the encoded images take too much time to draw as compare to bitmap image.

 

i replaced encodedImage with bitmap and problem is solved.

 

once again thanks for ur suggestions.