ImageUtils

A class containing utility methods related to bitmaps.

Types

Link copied to clipboard
Drawable result.

Functions

Link copied to clipboard
open fun calculateInSampleSize(width: Int, height: Int, reqWidth: Int, reqHeight: Int): Int
Calculate the largest inSampleSize value that is a power of 2 and keeps both height and width larger than the requested height and width.
Link copied to clipboard
open fun calculateTargetSize(width: Int, height: Int, reqWidth: Int, reqHeight: Int, fallbackWidth: Int, fallbackHeight: Int): ImageUtils.Size
Calculates a target size based on the original image aspect ratio if either the request width or request height are 0, otherwise returns the request size.
Link copied to clipboard
open fun fetchScaledBitmap(@NonNull context: Context, @NonNull url: URL, reqWidth: Int, reqHeight: Int): Bitmap
open fun fetchScaledBitmap(@NonNull context: Context, @NonNull url: URL, reqWidth: Int, reqHeight: Int, fallbackWidth: Int, fallbackHeight: Int): Bitmap
Create a scaled bitmap.
Link copied to clipboard
open fun fetchScaledDrawable(@NonNull context: Context, @NonNull url: URL, reqWidth: Int, reqHeight: Int): ImageUtils.DrawableResult
Fetches a drawable from an image path.
open fun fetchScaledDrawable(@NonNull context: Context, @NonNull url: URL, reqWidth: Int, reqHeight: Int, fallbackWidth: Int, fallbackHeight: Int): ImageUtils.DrawableResult
Fetches a drawable from an image path, using the supplied fallback dimensions if the ImageView reports a width or height of zero.