PaletteState

abstract class PaletteState<T : Any>(cacheSize: Int = DEFAULT_CACHE_SIZE, coroutineContext: CoroutineContext = Dispatchers.Default, builder: Palette.Builder.() -> Unit = {})

A state object that generates a Palette from an ImageBitmap using loader.

Parameters

T

The type of the input to load with loader.

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.

Constructors

Link copied to clipboard
constructor(cacheSize: Int = DEFAULT_CACHE_SIZE, coroutineContext: CoroutineContext = Dispatchers.Default, builder: Palette.Builder.() -> Unit = {})

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The last Palette that was generated.

Link copied to clipboard

The last PaletteResult of the Palette generation.

Functions

Link copied to clipboard
suspend fun generate(input: T)

Generates a Palette from input using loader.

Link copied to clipboard
fun reset()

Resets the PaletteState to its initial state and clears the cache if set.