private Bitmap getResourceAsBitmap(ImageWrapper w, int resId) { Bitmap b = loaderSettings.getResCacheManager().get("" + resId, w.getWidth(), w.getHeight()); if (b != null) { return b; } b = loaderSettings.getBitmapUtil().decodeResourceBitmapAndScale(w, resId, loaderSettings.isAllowUpsampling()); loaderSettings.getResCacheManager().put(String.valueOf(resId), b); return b; }
private void setResource(ImageWrapper w, int resId) { Bitmap b = loaderSettings.getResCacheManager().get("" + resId, w.getWidth(), w.getHeight()); if (b != null) { w.setBitmap(b, false); return; } b = loaderSettings.getBitmapUtil().decodeResourceBitmapAndScale(w, resId, loaderSettings.isAllowUpsampling()); loaderSettings.getResCacheManager().put("" + resId, b); w.setBitmap(b, false); }
private Bitmap getNotFoundImage() { String key = "resource" + notFoundResourceId + width + height; Bitmap b = loaderSettings.getResCacheManager().get(key, width, height); if (b != null) { return b; } if (context != null){ if (loaderSettings.isAlwaysUseOriginalSize()) { b = loaderSettings.getBitmapUtil().decodeResourceBitmap(context, width, height, notFoundResourceId); } else { b = loaderSettings.getBitmapUtil().decodeResourceBitmapAndScale(context, width, height, notFoundResourceId, loaderSettings.isAllowUpsampling()); } loaderSettings.getResCacheManager().put(key, b); } return b; }
private Bitmap getImageFromFile(File imageFile) { Bitmap b; if (loaderSettings.isAlwaysUseOriginalSize()) { b = loaderSettings.getBitmapUtil().decodeFile(imageFile, width, height); } else { b = loaderSettings.getBitmapUtil().decodeFileAndScale(imageFile, width, height, loaderSettings.isAllowUpsampling()); } if (b == null) { // decoding failed loaderSettings.getCacheManager().remove(url); return b; } if (saveScaledImage) { saveScaledImage(imageFile, b); } loaderSettings.getCacheManager().put(url, b); return b; }
b = loaderSettings.getBitmapUtil().decodeFile(imageFile, width, height); } else { b = loaderSettings.getBitmapUtil().decodeFileAndScale(imageFile, width, height, loaderSettings.isAllowUpsampling());