Пример #1
0
 /**
  * 将BitmapDrawable缩放为MImage
  *
  * @param bitmap
  * @param width
  * @param height
  * @return
  */
 public MImage convertImage(BitmapDrawable bitmap, int width, int height) {
   MImage origImage = new MImage(bitmap);
   if ((origImage.getWidth() != width) || (origImage.getHeight() != height)) {
     origImage.setScale(width, height);
   }
   return origImage;
 }
Пример #2
0
 public static Point setMode(MImage image, int width, int height, int mode) {
   Point point = new Point();
   if (mode == 1) {
     image.setScale(width, height);
   } else if (mode == 2) {
     int w = image.getWidth();
     int h = image.getHeight();
     int x = (width - w) / 2;
     int y = (height - h) / 2;
     point.x = x;
     point.y = y;
   }
   return point;
 }
Пример #3
0
 /** 根据屏幕大小对图标进行缩放 width, height都是以480*800为标准 */
 private void scaleImage(MImage origPic, int width, int height) {
   if ((origPic.getWidth() != width) || (origPic.getHeight() != height)) {
     origPic.setScale(width, height);
   }
 }