BitmapImageSource

ImageSource backed by a bitmap that is held whole in memory.

The bitmap is owned by the caller: this source never recycles it, not even on close. The caller can keep drawing on the bitmap when it is mutable, and the edits are visible in the next decoded region. Reads of the wrapped bitmap are synchronised on it, so callers must synchronise on the same bitmap while drawing on it.

Parameters

bitmap

caller-owned bitmap to wrap.

Constructors

Link copied to clipboard
constructor(bitmap: Bitmap)

Creates a source wrapping bitmap.

Properties

Link copied to clipboard
open override val orientation: Int

EXIF orientation of the wrapped bitmap, which is always ImageOrientation.NORMAL.

Link copied to clipboard
open override val storedHeight: Int

Height of the wrapped bitmap, in pixels.

Link copied to clipboard
open override val storedWidth: Int

Width of the wrapped bitmap, in pixels.

Functions

Link copied to clipboard
open override fun close()

Releases nothing: the wrapped bitmap belongs to the caller and is not recycled.

Link copied to clipboard
open fun contentChanged()

Notifies that the contents of the image changed, keeping its size.

Link copied to clipboard
open override fun decodeRegion(region: Rect, sampleSize: Int, config: Bitmap.Config, reuse: Bitmap?): Bitmap?

Draws a region of the wrapped bitmap scaled by 1 / sampleSize.