KiteBitmapCache

class KiteBitmapCache<T : Any>(budgetBytes: Long = DEFAULT_BUDGET_BYTES)

Platform bitmaps that a canvas built from images, so that an image drawn many times on a page, such as a tiled background or a row of icons, converts once (#117). A canvas keeps one cache for as long as it draws.

A bitmap is kept for one image instance and one KiteImageSampling: the same image drawn at another size needs another bitmap. The cache holds at most budgetBytes of bitmaps and drops the bitmap used least recently first. A bitmap larger than the whole budget is not kept.

Constructors

Link copied to clipboard
constructor(budgetBytes: Long = DEFAULT_BUDGET_BYTES)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The bytes of the bitmaps that the cache holds.

Functions

Link copied to clipboard
fun getOrPut(image: KiteImageData, sampling: KiteImageSampling, sizeOf: (T) -> Long, build: () -> T?): T?

The bitmap for image drawn with sampling. On a miss, build makes it and sizeOf gives its size in bytes. Returns null when build does.