ImageBitmap.Companion


Provide an empty companion object to hang platform-specific companion extensions onto.

Summary

Extension functions

ImageBitmap

Load an ImageBitmap from an image resource.

android
ImageBitmap

Load an ImageBitmap from an image resource.

android

Extension functions

imageResource

@Composable
fun ImageBitmap.Companion.imageResource(id: @DrawableRes Int): ImageBitmap

Load an ImageBitmap from an image resource.

This function is intended to be used for when low-level ImageBitmap-specific functionality is required. For simply displaying onscreen, the vector/bitmap-agnostic painterResource is recommended instead.

Parameters
id: @DrawableRes Int

the resource identifier

Returns
ImageBitmap

the decoded image data associated with the resource

imageResource

fun ImageBitmap.Companion.imageResource(res: Resources, id: @DrawableRes Int): ImageBitmap

Load an ImageBitmap from an image resource.

This function is intended to be used for when low-level ImageBitmap-specific functionality is required. For simply displaying onscreen, the vector/bitmap-agnostic painterResource is recommended instead.

Returns
ImageBitmap

Loaded image file represented as an ImageBitmap