开发者

BlackBerry - How to resize and store image?

开发者 https://www.devze.com 2022-12-30 22:31 出处:网络
I need to scale image to small and s开发者_JAVA技巧tore that image in to blackberry device (as a small image)?scaling an image is straightforward enough if the image is packaged, or even sourced over

I need to scale image to small and s开发者_JAVA技巧tore that image in to blackberry device (as a small image)?


scaling an image is straightforward enough if the image is packaged, or even sourced over the network or filesystem.

public EncodedImage scaleImage(EncodedImage source, int requiredWidth, int requiredHeight) {  
  int currentWidthFixed32 = Fixed32.toFP(source.getWidth());  
  int requiredWidthFixed32 = Fixed32.toFP(requiredWidth);  
  int scaleXFixed32 = Fixed32.div(currentWidthFixed32, requiredWidthFixed32);  
  int currentHeightFixed32 = Fixed32.toFP(source.getHeight());  
  int requiredHeightFixed32 = Fixed32.toFP(requiredHeight);  
  int scaleYFixed32 = Fixed32.div(currentHeightFixed32, requiredHeightFixed32);  
  return source.scaleImage32(scaleXFixed32, scaleYFixed32);  
}  

this returns a copy of the image, scaled according to the width and height you require it to be.


See
BlackBerry - How to resize image
How to save & delete a Bitmap image in Blackberry Storm?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号