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 |
|---|
public final class ColorBuilders.LinearGradient.BuilderBuilder for |
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 |
getEndX()Gets the ending y position of the linear gradient. |
@Nullable DimensionBuilders.OffsetDimension |
getEndY()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 |
toString() |
Public methods
getColorStops
public @NonNull List<ColorBuilders.ColorStop> getColorStops()
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
public @Nullable DimensionBuilders.OffsetDimension getEndX()
Gets the ending y position of the linear gradient. Defaults to the right side of the element.
getEndY
public @Nullable DimensionBuilders.OffsetDimension getEndY()
Gets the ending y position of the linear gradient. Defaults to the top side of the element.
getStartX
public @Nullable DimensionBuilders.OffsetDimension getStartX()
Gets the starting x position of the linear gradient. Defaults to the left side of the element.
getStartY
public @Nullable DimensionBuilders.OffsetDimension getStartY()
Gets the starting y position of the linear gradient. Defaults to the top side of the element.