Skip to content

BitmapScale

Alexander Zhirkevich edited this page Oct 5, 2022 · 3 revisions

Way of resizing image to the appropriate size.

fun interface BitmapScale {

    fun scale(drawable: Drawable, width : Int, height : Int) : Bitmap
}

Methods

fun scale(drawable: Drawable, width : Int, height : Int) : Bitmap

Create Bitmap from Drawable with desired width and height in a specific way.

Default implementations

Implementation Description
BitmapScale.FitXY Simple resize. Image aspect ration can be broken
BitmapScale.CenterCrop Crop given image and cut necessary bitmap from center. Image's aspect ratio will be kept
Clone this wiki locally