BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-02-2009, 08: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

Tektronix 132 Plug-In Power Supply and Amplifier
$30.99
Tektronix 132 Plug-In Power Supply and Amplifier pictureMITSUBISHI MR-J4-10B AC SERVO AMPLIFIER *NEW IN A BOX*
$315.0
MITSUBISHI MR-J4-10B AC SERVO AMPLIFIER *NEW IN A BOX*  picturePARKER ZX600-DRIVE-240V COMPUMOTOR SERVO DRIVE - ZX SERIES BRUSHLESS (Y3)
$650.0
PARKER ZX600-DRIVE-240V COMPUMOTOR SERVO DRIVE - ZX SERIES BRUSHLESS (Y3) pictureQBIT 9029 Amplifier 10-350MHz +18dB Gain +20dBm
$24.99
QBIT 9029 Amplifier 10-350MHz +18dB Gain +20dBm pictureQBIT 9031 Amplifier 10-160MHz +23dB Gain +20dBm
$29.99
QBIT 9031 Amplifier 10-160MHz +23dB Gain +20dBm picture






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