Builder

class Builder

Builder class for generating Palette instances.

Constructors

Link copied to clipboard
constructor(bitmap: ImageBitmap)

Construct a new Builder using a source ImageBitmap

constructor(swatches: List<Palette.Swatch>)

Construct a new Builder using a list of Swatch instances. Typically only used for testing.

Functions

Link copied to clipboard

Add a filter to be able to have fine grained control over which colors are allowed in the resulting palette.

Link copied to clipboard

Add a target profile to be generated in the palette.

Link copied to clipboard

Clear all added filters. This includes any default filters added automatically by Palette.

Link copied to clipboard

Clear any previously region set via .setRegion.

Link copied to clipboard

Clear all added targets. This includes any default targets added automatically by Palette.

Link copied to clipboard

Generate and return the Palette synchronously.

Link copied to clipboard

Set the maximum number of colors to use in the quantization step when using a ImageBitmap as the source.

Link copied to clipboard

Set the resize value when using a ImageBitmap as the source. If the bitmap's area is greater than the value specified, then the bitmap will be resized so that its area matches area. If the bitmap is smaller or equal, the original is used as-is.

Link copied to clipboard
fun setRegion(left: Int, top: Int, right: Int, bottom: Int): Palette.Builder

Set a region of the bitmap to be used exclusively when calculating the palette.