Question

How to scale image (Bitmap/EncodedImage) efficiently in Blackberry (using OpenVG/OpenGL if hardware acceleration supported). Can something like VGField/GLField be used to achieve that?

I have already tried Bitmap.scaleInto(...), EncodedImage.scaleImage32(..) and some naive algorithms (raw data manipulation). Also I can't use ZoomScreen because it is not possible (?) to change the image of an ZoomScreen instance dynamically.

Need some idea about how the default image viewer application in BlackBerry device (e.g. Torch 9800) performs smooth pinch zooming.

Was it helpful?

Solution

The usual technique is:

  • Step 1: scale the current thumbnail, so you get a rather blocky looking image, but has the advantage of working nearly instantaneously.

  • Step 2: kick off the higher resolution image decoder on a separate thread. When it is done, it sends the newly decoded image back to the UI thread to replace the approximate image that was used from step 1.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top