decodeRegion

abstract fun decodeRegion(region: Rect, sampleSize: Int, config: Bitmap.Config, reuse: Bitmap?): Bitmap?

Decodes a region of the image.

This method is called on a worker thread and is never called concurrently with itself or with contentChanged.

Return

decoded bitmap, which is owned by the caller from then on, or null if decoding failed.

Parameters

region

region to decode, expressed in stored pixels.

sampleSize

subsampling factor, a power of two. A value of N yields a bitmap N times smaller on each side.

config

bitmap configuration requested for the result.

reuse

bitmap that may be reused to hold the result, or null. Implementations are free to ignore it.