11-29-2008 08:40 AM
I am developing the application in which I am downloading large images from server and storing it in
particular location on device
I have to display that downloaded images on screen with Horizontally and vertically centered position
if the image size is small then it should fit at center of the screen
& if the image large then it should resize.
In short in media browser if we open any image then it fits automatically.
same thing, I have to do using my application.
I have tried the code given in the forum
but this does not work for large images i.e. image size greater that 800kb.
How to do that ? any ideas
Thanks in advance.
11-30-2008 10:41 AM
Implement your own control to show large images, for example your own BitmapField that interacts with keys to show image by parts.
Download image to the memory and show one part of it.
When a scroll key pressed or trackwheel action performed - repaint your control to show different part of your image.
11-30-2008 01:50 PM
See this post for scrolling code:
What happens with the large images - you tell us it doesn't work but not what goes wrong.
12-02-2008 01:24 PM
Can you confirm my understanding that you want to be able to show the complete image, scaled down if too large, on the Blackberry screen?
What resolution are these large images? Have you figured out how much storage it will take to convert the whole image to ARGB? For example, if these images are 800*600, then I think the ARGB form would require 800*600*4 bytes, i.e. approximately 2MB. If your images are larger than this, I'm not surprised you are running out of memory.
If this is the case, then I suspect that you can rework the algorithm to do a bit at a time, then use the x,y, width and height in the getARGB routine to extract subsets of the data. Doing it bit at a time means you don't have the entire image in memory at once.
Just a thought.
12-02-2008 11:42 PM
Yes, Peter I want to show the complete image, scaled down if too large, on the Blackberry screen.
But in native file browser if I tried to open that image then it shows correctly.
what technique is used in native file browser ?
12-03-2008 02:10 AM
If u want to scroll large image that is greater than scrwidth and scheight of BB,then use navigationMovement method,from here u can get dx,dy value in both direction and after calculating,in which manager u have added this image just use setHorizontalScroll or setVerticalScroll with the value,which is how much u want to scroll.
12-03-2008 05:56 PM
How does the native browser do it? Don't know sorry, don't work for Rim.......
But I reckon if they tried to load the entire image and convert it using ARGB format, they too would run out of memory. I'll bet they have some very clever processing that scales as it as it is converting the png/jpg/whatever file for display anyway. But I suspect you do not want to know the intricacies of a compressed picture files, which is why I suggested doing it bit at a time. I think that approach will work.