Google は、黒人コミュニティに対する人種平等の促進に取り組んでいます。取り組みを見る

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
setLightnessWeight(@FloatRange(0) weight: Float)

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

Target.Builder
setMaximumLightness(@FloatRange(0, 1) value: Float)

Set the maximum lightness value for this target.

Target.Builder
setMaximumSaturation(@FloatRange(0, 1) value: Float)

Set the maximum saturation value for this target.

Target.Builder
setMinimumLightness(@FloatRange(0, 1) value: Float)

Set the minimum lightness value for this target.

Target.Builder
setMinimumSaturation(@FloatRange(0, 1) value: Float)

Set the minimum saturation value for this target.

Target.Builder
setPopulationWeight(@FloatRange(0) weight: Float)

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

Target.Builder
setSaturationWeight(@FloatRange(0) weight: Float)

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

Target.Builder
setTargetLightness(@FloatRange(0, 1) value: Float)

Set the target/ideal lightness value for this target.

Target.Builder
setTargetSaturation(@FloatRange(0, 1) value: Float)

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(@FloatRange(0) 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(@FloatRange(0, 1) value: Float): Target.Builder

Set the maximum lightness value for this target.

setMaximumSaturation

@NonNull fun setMaximumSaturation(@FloatRange(0, 1) value: Float): Target.Builder

Set the maximum saturation value for this target.

setMinimumLightness

@NonNull fun setMinimumLightness(@FloatRange(0, 1) value: Float): Target.Builder

Set the minimum lightness value for this target.

setMinimumSaturation

@NonNull fun setMinimumSaturation(@FloatRange(0, 1) value: Float): Target.Builder

Set the minimum saturation value for this target.

setPopulationWeight

@NonNull fun setPopulationWeight(@FloatRange(0) 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(@FloatRange(0) 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(@FloatRange(0, 1) value: Float): Target.Builder

Set the target/ideal lightness value for this target.

setTargetSaturation

@NonNull fun setTargetSaturation(@FloatRange(0, 1) value: Float): Target.Builder

Set the target/ideal saturation value for this target.