Builder
class Builder
kotlin.Any | |
↳ | androidx.palette.graphics.Target.Builder |
Builder class for generating custom Target
instances.
Summary
Public constructors | |
---|---|
<init>() Create a new |
|
Create a new builder based on an existing |
Public methods | |
---|---|
Target |
build() Builds and returns the resulting |
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
Public methods
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.
See Also
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.
See Also
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.