1

How can you scale an image - whether it be using Bitmap or EncodedImage to fill the entire width and height of a field?

Tried this:

protected void paintBackground(Graphics g) {
    super.paintBackground(g);
     //try bitmap
     //g.drawBitmap(0, 0, this.getWidth(), this.getHeight(), image 0, 0);
     //try encoded image
     g.drawImage(0, 0, this.getContentWidth(), this.getContentHeight(), image, 0, 0, 0);

}
gdub
  • 793
  • 9
  • 16

1 Answers1

2

This questn is asked before here is link Blackberry - how to resize image?

In OS 5.0 the api scaleInto method is provided in Bitmap class i.e http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/system/Bitmap.html#scaleInto%28net.rim.device.api.system.Bitmap,%20int%29

For Below OS 5.0 this bb kb article will be helpful for image manipulations http://supportforums.blackberry.com/t5/Java-Development/Rotate-and-scale-bitmaps/ta-p/492524

Community
  • 1
  • 1
amsiddh
  • 3,513
  • 2
  • 24
  • 27
  • Thanks, I'm targeting devices a old as 4.5. I have the encodedimage resizing function you mention elsewhere is my code - my problem is more in passing the width/height to these functions. getWidth() and getHeight() of these field seem to be outputting some large integers that throw errors when passed to the resizing functions. – gdub Feb 16 '11 at 16:37