{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

ImageBitmap.Companion

public static class ImageBitmap.Companion


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

Summary

Extension functions

static final @NonNull ImageBitmap

Load an ImageBitmap from an image resource.

static final @NonNull ImageBitmap
ImageResourcesKt.imageResource(
    @NonNull ImageBitmap.Companion receiver,
    @NonNull Resources res,
    @DrawableRes int id
)

Load an ImageBitmap from an image resource.

Extension functions

ImageResourcesKt.imageResource

@Composable
public static final @NonNull ImageBitmap ImageResourcesKt.imageResource(
    @NonNull ImageBitmap.Companion receiver,
    @DrawableRes int id
)

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
@DrawableRes int id

the resource identifier

Returns
@NonNull ImageBitmap

the decoded image data associated with the resource

ImageResourcesKt.imageResource

public static final @NonNull ImageBitmap ImageResourcesKt.imageResource(
    @NonNull ImageBitmap.Companion receiver,
    @NonNull Resources res,
    @DrawableRes int id
)

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
@NonNull ImageBitmap

Loaded image file represented as an ImageBitmap