Builder

class Builder
kotlin.Any
   ↳ androidx.palette.graphics.Target.Builder

Builder class for generating custom Target instances.

Summary

Public constructors

Create a new Target builder from scratch.

<init>(@NonNull target: Target)

Create a new builder based on an existing Target.

Public methods

Target

Builds and returns the resulting Target.

Target.Builder
setExclusive(exclusive: Boolean)

Set whether any color selected for this target is exclusive to this target only.

Target.Builder

Set the weight of importance that this target will place on lightness values.

Target.Builder

Set the maximum lightness value for this target.

Target.Builder

Set the maximum saturation value for this target.

Target.Builder

Set the minimum lightness value for this target.

Target.Builder

Set the minimum saturation value for this target.

Target.Builder

Set the weight of importance that this target will place on a color's population within the image.

Target.Builder

Set the weight of importance that this target will place on saturation values.

Target.Builder

Set the target/ideal lightness value for this target.

Target.Builder

Set the target/ideal saturation value for this target.

Public constructors

<init>

Builder()

Create a new Target builder from scratch.

<init>

Builder(@NonNull target: Target)

Create a new builder based on an existing Target.

Public methods

build

@NonNull fun build(): Target

Builds and returns the resulting Target.

setExclusive

@NonNull fun setExclusive(exclusive: Boolean): Target.Builder

Set whether any color selected for this target is exclusive to this target only. Defaults to true.

Parameters
exclusive Boolean: true if any the color is exclusive to this target, or false is the color can be selected for other targets.

setLightnessWeight

@NonNull fun setLightnessWeight(weight: Float): Target.Builder

Set the weight of importance that this target will place on lightness values.

The larger the weight, relative to the other weights, the more important that a color being close to the target value has on selection.

A weight of 0 means that it has no weight, and thus has no bearing on the selection.

setMaximumLightness

@NonNull fun setMaximumLightness(value: Float): Target.Builder

Set the maximum lightness value for this target.

setMaximumSaturation

@NonNull fun setMaximumSaturation(value: Float): Target.Builder

Set the maximum saturation value for this target.

setMinimumLightness

@NonNull fun setMinimumLightness(value: Float): Target.Builder

Set the minimum lightness value for this target.

setMinimumSaturation

@NonNull fun setMinimumSaturation(value: Float): Target.Builder

Set the minimum saturation value for this target.

setPopulationWeight

@NonNull fun setPopulationWeight(weight: Float): Target.Builder

Set the weight of importance that this target will place on a color's population within the image.

The larger the weight, relative to the other weights, the more important that a color's population being close to the most populous has on selection.

A weight of 0 means that it has no weight, and thus has no bearing on the selection.

setSaturationWeight

@NonNull fun setSaturationWeight(weight: Float): Target.Builder

Set the weight of importance that this target will place on saturation values.

The larger the weight, relative to the other weights, the more important that a color being close to the target value has on selection.

A weight of 0 means that it has no weight, and thus has no bearing on the selection.

setTargetLightness

@NonNull fun setTargetLightness(value: Float): Target.Builder

Set the target/ideal lightness value for this target.

setTargetSaturation

@NonNull fun setTargetSaturation(value: Float): Target.Builder

Set the target/ideal saturation value for this target.