BitmapPool

interface BitmapPool

An object pool that enables callers to reuse Bitmap objects.

Types

Companion
Link copied to clipboard
object Companion

Functions

clear
Link copied to clipboard
abstract fun clear()

Remove all Bitmaps from this pool and free their memory.

get
Link copied to clipboard
abstract fun get(@Px width: Int, @Px height: Int, config: Bitmap.Config): Bitmap

Return a Bitmap of exactly the given width, height, and configuration, and containing only transparent pixels.

getDirty
Link copied to clipboard
abstract fun getDirty(@Px width: Int, @Px height: Int, config: Bitmap.Config): Bitmap

Identical to get except that any returned Bitmap may not have been erased and may contain random data.

getDirtyOrNull
Link copied to clipboard
abstract fun getDirtyOrNull(@Px width: Int, @Px height: Int, config: Bitmap.Config): Bitmap?

Identical to getDirty except that null will be returned if the pool does not contain a usable bitmap.

getOrNull
Link copied to clipboard
abstract fun getOrNull(@Px width: Int, @Px height: Int, config: Bitmap.Config): Bitmap?

Identical to get except that null will be returned if the pool does not contain a usable bitmap.

put
Link copied to clipboard
abstract fun put(bitmap: Bitmap)

Add the given Bitmap to the pool if it is eligible to be re-used and the pool can fit it. Otherwise, this method calls Bitmap.recycle on the bitmap and discards it.

trimMemory
Link copied to clipboard
abstract fun trimMemory(level: Int)