ColorBuilders.LinearGradient.Builder


public final class ColorBuilders.LinearGradient.Builder


Builder for LinearGradient.

Summary

Public constructors

@RequiresSchemaVersion(major = 1, minor = 500)
@SafeVarargs
Builder(@NonNull ColorBuilders.ColorStop[] colorStops)

Creates an instance of Builder.

@RequiresSchemaVersion(major = 1, minor = 500)
@SafeVarargs
Builder(@NonNull ColorBuilders.ColorProp[] colors)

Creates an instance of Builder.

Public methods

@NonNull ColorBuilders.LinearGradient

Builds an instance from accumulated values.

@NonNull ColorBuilders.LinearGradient.Builder

Sets the ending y position of the linear gradient.

@NonNull ColorBuilders.LinearGradient.Builder

Sets the ending y position of the linear gradient.

@NonNull ColorBuilders.LinearGradient.Builder

Sets the starting x position of the linear gradient.

@NonNull ColorBuilders.LinearGradient.Builder

Sets the starting y position of the linear gradient.

Public constructors

Builder

@RequiresSchemaVersion(major = 1, minor = 500)
@SafeVarargs
public Builder(@NonNull ColorBuilders.ColorStop[] colorStops)

Creates an instance of Builder.

Parameters
@NonNull ColorBuilders.ColorStop[] colorStops

The color stops defining how the colors are distributed from the start to the end coordinates.

A color stop is a pair of a color and its offset in the gradient. The offset is the relative position of the color, beginning with 0 from the start coordinate and ending with 1.0 at the end coordinate.

Throws
java.lang.IllegalArgumentException

if the number of colors is less than 2 or larger than 10.

Builder

@RequiresSchemaVersion(major = 1, minor = 500)
@SafeVarargs
public Builder(@NonNull ColorBuilders.ColorProp[] colors)

Creates an instance of Builder.

The colors are evenly distributed in the gradient.

Parameters
@NonNull ColorBuilders.ColorProp[] colors

The color sequence to be distributed between the gradient's start and end coordinates.

Throws
java.lang.IllegalArgumentException

if the number of colors is less than 2 or larger than 10.

Public methods

build

Added in 1.3.0-alpha06
public @NonNull ColorBuilders.LinearGradient build()

Builds an instance from accumulated values.

Throws
java.lang.IllegalStateException

if size of colorStops is less than 2 or greater than 10.

setEndX

Added in 1.3.0-alpha06
@RequiresSchemaVersion(major = 1, minor = 500)
public @NonNull ColorBuilders.LinearGradient.Builder setEndX(@NonNull DimensionBuilders.OffsetDimension endX)

Sets the ending y position of the linear gradient. Defaults to the right side of the element.

setEndY

Added in 1.3.0-alpha06
@RequiresSchemaVersion(major = 1, minor = 500)
public @NonNull ColorBuilders.LinearGradient.Builder setEndY(@NonNull DimensionBuilders.OffsetDimension endY)

Sets the ending y position of the linear gradient. Defaults to the top side of the element.

setStartX

Added in 1.3.0-alpha06
@RequiresSchemaVersion(major = 1, minor = 500)
public @NonNull ColorBuilders.LinearGradient.Builder setStartX(@NonNull DimensionBuilders.OffsetDimension startX)

Sets the starting x position of the linear gradient. Defaults to the left side of the element.

setStartY

Added in 1.3.0-alpha06
@RequiresSchemaVersion(major = 1, minor = 500)
public @NonNull ColorBuilders.LinearGradient.Builder setStartY(@NonNull DimensionBuilders.OffsetDimension startY)

Sets the starting y position of the linear gradient. Defaults to the top side of the element.