BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-02-2009, 09:01 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2009
Location: Belarus, Minsk
Model: none
PIN: N/A
Carrier: none
Posts: 17
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default How to set constant size of BitmapField?

Please Login to Remove!

Hi to all. I want to set my custom BitmapField to some constant size. I tried setExtent(), but my BitmapField automatically changes it size when I change it content.
Offline  
Old 12-08-2009, 07:55 PM   #2 (permalink)
New Member
 
Join Date: Dec 2009
Model: 9700
PIN: N/A
Carrier: ATT
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Setting BitmapSize

the best way to set the size of a bitmap is to use encodedimage.

I personally use a function i made SizePic....

//make your encodedimage
EncodedImage eimage;

//get encodedimage info either through bytes or from project resource

//add the bitmap
add(new BitmapField(SizePic(eimage,30,30)));


public static Bitmap SizePic (EncodedImage Resizor,int Height, int Width) {
int multH;
int multW;
int currHeight = Resizor.getHeight();
int currWidth = Resizor.getWidth();
multH= Fixed32.div(Fixed32.toFP(currHeight),Fixed32.toFP( Height));
multW = Fixed32.div(Fixed32.toFP(currWidth),Fixed32.toFP(W idth));
Resizor = Resizor.scaleImage32(multW,multH);
return Resizor.getBitmap();
}

with that you can call resizor to make the image 30x30 or declare what ever constant you want for the size
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.