예제 #1
0
 /**
  * 根据Drawable Id生成对应的MImage
  *
  * @param drawableId
  * @param width
  * @param height
  * @param angle
  * @return
  */
 private MImage generateMImage(int drawableId, int width, int height, float angle) {
   BitmapDrawable drawable = (BitmapDrawable) mPicManager.getViewDrawable(drawableId);
   MImage img = new MImage(drawable);
   scaleImage(img, width, height);
   img.setRotation(angle);
   return img.getDrawingCache();
 }
예제 #2
0
 /**
  * 获得格式为Drawable的图片
  *
  * @param drawableId
  * @return
  */
 public Drawable getDrawable(int drawableId) {
   Drawable img = null;
   try {
     if (mPublicResources.containsKey(drawableId)) {
       // 与主题无关的资源不保存在主题资源管理器中
       img = getDrawableFromMainPkg(drawableId);
     } else {
       img = mPicManager.getViewDrawable(drawableId);
     }
   } catch (OutOfMemoryError e) {
     Log.d("XViewFrame", "Hoops! Out of Memeory");
     e.printStackTrace();
     OutOfMemoryHandler.handle();
   }
   return img;
 }