BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-06-2009, 07:20 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: berlin, germany
Model: 8310
PIN: N/A
Carrier: vodafone
Posts: 163
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default resize an PNG

Please Login to Remove!

Hi,
I want to scale an png Image in myApplication. I have found these ways:
PHP Code:
// 1. way
EncodedImage ei EncodedImage.getEncodedImageResource("splash.png");
BitmapField bmp = new BitmapField(ei.scaleImage32(50,75).getBitmap());   
mainScreen.add(bmp);
            
// 2. way            
EncodedImage image EncodedImage.getEncodedImageResource("splash.png");
image.scaleImage32(50,75);
BitmapField field = new BitmapField();
field.setImage(image); 
mainScreen.add(field); 
But when I try the first way the BB turns off
If I try the second way nothing happens, the image is still the same.

When I try the second way with image = image.scaleImage32(50,75); then I get an Exception.

If I use image.setScale(2); then the image is scaled down. But i want to scale it up. So how do I do this??

Google has no answers for me, an if so then take a look at way 1 and way 2

Maybe someone can help me.

thanks hibbert
__________________
My English is so bad, that makes me nobody so quickly after
Offline  
Old 08-06-2009, 09:13 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Quote:
Originally Posted by hibbert View Post
Hi,
I want to scale an png Image in myApplication. I have found these ways:
PHP Code:
// 1. way
EncodedImage ei EncodedImage.getEncodedImageResource("splash.png");
BitmapField bmp = new BitmapField(ei.scaleImage32(50,75).getBitmap());   
mainScreen.add(bmp);
            
// 2. way            
EncodedImage image EncodedImage.getEncodedImageResource("splash.png");
image.scaleImage32(50,75);
BitmapField field = new BitmapField();
field.setImage(image); 
mainScreen.add(field); 
But when I try the first way the BB turns off
If I try the second way nothing happens, the image is still the same.

When I try the second way with image = image.scaleImage32(50,75); then I get an Exception.

If I use image.setScale(2); then the image is scaled down. But i want to scale it up. So how do I do this??

Google has no answers for me, an if so then take a look at way 1 and way 2

Maybe someone can help me.

thanks hibbert
Just a guess but I don't think 50 and 75 represent the Fixed32 values you want to use (per the documentation for EncodedImage.scaleImage32().
__________________
My other Blackberry is a PlayBook.
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.