BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 03-30-2007, 02: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.
Code:
                    
myImage = EncodedImage.createEncodedImage(bytes,0,-1).scaleImage32(xScale,yScale);
updateBitmap(myImage);

private void updateBitmap(final EncodedImage myImage) {
    _mainScreen.getApplication().invokeLater(new Runnable() {
        public void run(){
                _imageField.setImage(myImage);
            }
        });
    }
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.
Offline  
Old 04-01-2007, 06: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
Default

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.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.