rememberPaletteState

fun rememberPaletteState(cacheSize: Int = DominantColorState.DEFAULT_CACHE_SIZE, coroutineContext: CoroutineContext = Dispatchers.Default, builder: Palette.Builder.() -> Unit = {}): PaletteState<ImageBitmap>

Creates a PaletteState that will be remembered across compilation and can be used to generate a Palette from an ImageBitmap.

Return

A PaletteState that will be remembered across composition.

Parameters

cacheSize

The maximum number of Palettes to cache. If 0, no caching will be done.

coroutineContext

The CoroutineContext to use for generating Palettes.

builder

A lambda that will be applied to the Palette.Builder to customize the generation of the Palette.


fun <T : Any> rememberPaletteState(loader: ImageBitmapLoader<T>, cacheSize: Int = DominantColorState.DEFAULT_CACHE_SIZE, coroutineContext: CoroutineContext = Dispatchers.Default, builder: Palette.Builder.() -> Unit = {}): PaletteState<T>

Creates a PaletteState that will be remembered across compilation and can be used to generate a Palette from an ImageBitmap using loader.

Return

A PaletteState that will be remembered across composition.

Parameters

T

The type of the input to load with loader.

loader

The ImageBitmapLoader to use for loading Ts.

cacheSize

The maximum number of Palettes to cache. If 0, no caching will be done.

coroutineContext

The CoroutineContext to use for generating Palettes.

builder

A lambda that will be applied to the Palette.Builder to customize the generation of the Palette.