Target.Builder


public final class Target.Builder


Builder class for generating custom Target instances.

Summary

Public constructors

Create a new Target builder from scratch.

Create a new builder based on an existing Target.

Public methods

@NonNull Target

Builds and returns the resulting Target.

@NonNull Target.Builder
setExclusive(boolean exclusive)

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

@NonNull Target.Builder
setLightnessWeight(@FloatRange(from = 0) float weight)

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

@NonNull Target.Builder
setMaximumLightness(@FloatRange(from = 0, to = 1) float value)

Set the maximum lightness value for this target.

@NonNull Target.Builder
setMaximumSaturation(@FloatRange(from = 0, to = 1) float value)

Set the maximum saturation value for this target.

@NonNull Target.Builder
setMinimumLightness(@FloatRange(from = 0, to = 1) float value)

Set the minimum lightness value for this target.

@NonNull Target.Builder
setMinimumSaturation(@FloatRange(from = 0, to = 1) float value)

Set the minimum saturation value for this target.

@NonNull Target.Builder
setPopulationWeight(@FloatRange(from = 0) float weight)

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

@NonNull Target.Builder
setSaturationWeight(@FloatRange(from = 0) float weight)

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

@NonNull Target.Builder
setTargetLightness(@FloatRange(from = 0, to = 1) float value)

Set the target/ideal lightness value for this target.

@NonNull Target.Builder
setTargetSaturation(@FloatRange(from = 0, to = 1) float value)

Set the target/ideal saturation value for this target.

Public constructors

Builder

Added in 1.0.0
public Builder()

Create a new Target builder from scratch.

Builder

Added in 1.0.0
public Builder(@NonNull Target target)

Create a new builder based on an existing Target.

Public methods

build

Added in 1.0.0
public @NonNull Target build()

Builds and returns the resulting Target.

setExclusive

Added in 1.0.0
public @NonNull Target.Builder setExclusive(boolean exclusive)

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

Parameters
boolean exclusive

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

setLightnessWeight

Added in 1.0.0
public @NonNull Target.Builder setLightnessWeight(@FloatRange(from = 0) float weight)

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

Added in 1.0.0
public @NonNull Target.Builder setMaximumLightness(@FloatRange(from = 0, to = 1) float value)

Set the maximum lightness value for this target.

setMaximumSaturation

Added in 1.0.0
public @NonNull Target.Builder setMaximumSaturation(@FloatRange(from = 0, to = 1) float value)

Set the maximum saturation value for this target.

setMinimumLightness

Added in 1.0.0
public @NonNull Target.Builder setMinimumLightness(@FloatRange(from = 0, to = 1) float value)

Set the minimum lightness value for this target.

setMinimumSaturation

Added in 1.0.0
public @NonNull Target.Builder setMinimumSaturation(@FloatRange(from = 0, to = 1) float value)

Set the minimum saturation value for this target.

setPopulationWeight

Added in 1.0.0
public @NonNull Target.Builder setPopulationWeight(@FloatRange(from = 0) float weight)

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

Added in 1.0.0
public @NonNull Target.Builder setSaturationWeight(@FloatRange(from = 0) float weight)

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

Added in 1.0.0
public @NonNull Target.Builder setTargetLightness(@FloatRange(from = 0, to = 1) float value)

Set the target/ideal lightness value for this target.

setTargetSaturation

Added in 1.0.0
public @NonNull Target.Builder setTargetSaturation(@FloatRange(from = 0, to = 1) float value)

Set the target/ideal saturation value for this target.