List of usage examples for android.graphics Bitmap setHasMipMap
public final void setHasMipMap(boolean hasMipMap)
From source file:com.laurencedawson.image_management.ImageManager.java
/** * Decode a Bitmap with a given max width and height * @param file The Bitmap file//from w w w.jav a 2s .com * @param reqWidth The requested width of the resulting bitmap * @param reqHeight The requested height of the resulting bitmap * @return The Bitmap image */ @SuppressLint("NewApi") public static Bitmap decodeBitmap(final File file, final int reqWidth, final int reqHeight) { // Serialize all decode on a global lock to reduce concurrent heap usage. synchronized (DECODE_LOCK) { // Check if the file doesn't exist or has no content if (!file.exists() || file.exists() && file.length() == 0) { return null; } // Load a scaled version of the bitmap Options opts = null; opts = getOptions(file, reqWidth, reqHeight); // Set a few additional options for the bitmap opts opts.inPurgeable = true; opts.inInputShareable = true; opts.inDither = true; // Grab the bitmap Bitmap bitmap = BitmapFactory.decodeFile(file.getPath(), opts); // If on JellyBean attempt to draw with mipmaps enabled if (bitmap != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { bitmap.setHasMipMap(true); } // return the decoded bitmap return bitmap; } }