coil-base / coil.bitmappool / BitmapPool

BitmapPool

interface BitmapPool

An object pool that enables callers to reuse Bitmap objects.

Functions

Name Summary
clear Remove all Bitmaps from this pool and free their memory.abstract fun clear():Unit
get Return a Bitmap of exactly the given width, height, and configuration, and containing only transparent pixels.abstract fun get(width:Int, height:Int, config:Config):Bitmap
getDirty Identical to get except that any returned Bitmap may not have been erased and may contain random data.abstract fun getDirty(width:Int, height:Int, config:Config):Bitmap
getDirtyOrNull Identical to getDirty except that null will be returned if the pool does not contain a usable bitmap.abstract fun getDirtyOrNull(width:Int, height:Int, config:Config):Bitmap?
getOrNull Identical to get except that null will be returned if the pool does not contain a usable bitmap.abstract fun getOrNull(width:Int, height:Int, config:Config):Bitmap?
put 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.abstract fun put(bitmap:Bitmap):Unit
trimMemory abstract fun trimMemory(level:Int):Unit

Companion Object Functions

Name Summary
invoke Create a new BitmapPool.operator fun invoke(maxSize:Int):BitmapPool