ColorBuilders.LinearGradient


@RequiresSchemaVersion(major = 1, minor = 500)
public final class ColorBuilders.LinearGradient implements ColorBuilders.Brush


A linear gradient with the provided colors based on defined start and end coordinates.

The colors are dispersed at the offsets defined in each color stop.

Summary

Nested types

Builder for LinearGradient.

Public methods

@NonNull List<ColorBuilders.ColorStop>

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

@Nullable DimensionBuilders.OffsetDimension

Gets the ending y position of the linear gradient.

@Nullable DimensionBuilders.OffsetDimension

Gets the ending y position of the linear gradient.

@Nullable DimensionBuilders.OffsetDimension

Gets the starting x position of the linear gradient.

@Nullable DimensionBuilders.OffsetDimension

Gets the starting y position of the linear gradient.

@NonNull String

Public methods

getColorStops

Added in 1.3.0-alpha06
public @NonNull List<ColorBuilders.ColorStopgetColorStops()

Gets 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 at the start coordinate and ending with 1.0 at the end coordinate.

There must be at least 2 colors and at most 10 colors.

If offset values are not set, the colors are evenly distributed in the gradient.

getEndX

Added in 1.3.0-alpha06
public @Nullable DimensionBuilders.OffsetDimension getEndX()

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

getEndY

Added in 1.3.0-alpha06
public @Nullable DimensionBuilders.OffsetDimension getEndY()

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

getStartX

Added in 1.3.0-alpha06
public @Nullable DimensionBuilders.OffsetDimension getStartX()

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

getStartY

Added in 1.3.0-alpha06
public @Nullable DimensionBuilders.OffsetDimension getStartY()

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

toString

public @NonNull String toString()