androidx.compose.ui.graphics

ImageBitmap

Interface · from org.jetbrains.compose.ui:ui-graphics:1.12.2

No hand-written docs yet.

Graphics object that represents a 2 dimensional array of pixel information represented as ARGB values

interface ImageBitmap

How to get one

Create it

Used by

Parameters that take a ImageBitmap.

Properties

width

val width: Int

The number of image pixels along the ImageBitmap's horizontal axis.

height

val height: Int

The number of image pixels along the ImageBitmap's vertical axis.

colorSpace

val colorSpace: ColorSpace

ColorSpace the Image renders in

hasAlpha

val hasAlpha: Boolean

Determines whether or not the ImageBitmap contains an alpha channel

config

val config: ImageBitmapConfig

Returns the current configuration of this Image, either:

Functions

readPixels

fun readPixels(
    buffer: IntArray,
    startX: Int = 0,
    startY: Int = 0,
    width: Int = this.width,
    height: Int = this.height,
    bufferOffset: Int = 0,
    stride: Int = width,
)

Copies the pixel data within the ImageBitmap into the given array. Each value is represented as ARGB values packed into an Int. The stride parameter allows the caller to allow for gaps in the returned pixels array between rows. For normal packed, results, the stride value is equivalent to the width of the ImageBitmap. The returned colors are non-premultiplied ARGB values in the ColorSpaces.Srgb color space.

prepareToDraw

fun prepareToDraw()

Builds caches associated with the ImageBitmap that are used for drawing it. This method can be used as a signal to upload textures to the GPU to eventually be rendered

Library docs

Graphics object that represents a 2 dimensional array of pixel information represented as ARGB values