downSamplingToImageBitmap

actual suspend fun ByteArray.downSamplingToImageBitmap(coroutineScope: CoroutineScope, reqHeight: Int, reqWidth: Int): ImageBitmap?
expect suspend fun ByteArray.downSamplingToImageBitmap(coroutineScope: CoroutineScope, reqHeight: Int, reqWidth: Int): ImageBitmap?

Returns a bitmap with down sampling for the current screen size.

This is an expect function; it's actual implementation is platform-specific.

A coroutineScope is needed as this is a CPU intensive task and user may forget to use Dispatchers.Default leading to errors or app crash. This method uses the coroutineScope with Dispatchers.Default.

Parameters

reqHeight

= height of the screen on which the image will be displayed.

reqWidth

= width of the screen on which the image will be displayed.

Throws

it throws any exception caught while down sampling the image.

actual suspend fun ByteArray.downSamplingToImageBitmap(coroutineScope: CoroutineScope, reqHeight: Int, reqWidth: Int): ImageBitmap?
actual suspend fun ByteArray.downSamplingToImageBitmap(coroutineScope: CoroutineScope, reqHeight: Int, reqWidth: Int): ImageBitmap?