BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 03-30-2007, 01:43 PM   #1 (permalink)
New Member
Join Date: Jan 2007
Location: Ottawa
Model: 8100
Carrier: Rogers
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Image Zoom

Please Login to Remove!

I have planned to add zoom in and zoom out functions to my blackberry program.
myImage = EncodedImage.createEncodedImage(bytes,0,-1).scaleImage32(xScale,yScale);

private void updateBitmap(final EncodedImage myImage) {
    _mainScreen.getApplication().invokeLater(new Runnable() {
        public void run(){
The program can zoom in or out by changing the values of xScale and yScale. However, when I zoom in, the bitmap field only shows the upper left corner of the original graph. Does anybody know a way to show the center part of the original image when I zoom in and by moving the wheel ball it can show any part of the original graph.

Thanks ahead.
Old 04-01-2007, 05:50 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
Skipper_Joe's Avatar
Join Date: Jan 2007
Location: Kharkov, Ukraine
Model: 8300
Carrier: N/A
Posts: 237
Post Thanks: 0
Thanked 0 Times in 0 Posts

if I understand properly, type of _imageField variable is BitmapField.

I can suggest to create your own Field and implement Field.paint(Graphics g) there. There is Graphics.drawImage(int x, int y, int width, int height, EncodedImage image, int frameIndex, int left, int top), which you can use there and you can set left and top variables to define necessary part of your image.

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.