public final class Gradient extends CanvasObject
Linear
or Radial
.CANVAS
or CHART
area.Modifier and Type | Class and Description |
---|---|
static class |
Gradient.GradientFactory
Inner class to create gradient by a native object.
|
Constructor and Description |
---|
Gradient()
Creates a LINEAR gradient, with
topDown orientation and chart scope. |
Gradient(GradientType type)
Creates a gradient by a type, with
chart scope. |
Gradient(GradientType type,
GradientOrientation orientation)
Creates a gradient by a type and an orientation, with
chart scope. |
Gradient(GradientType type,
GradientOrientation orientation,
GradientScope scope)
Creates a gradient by a type, an orientation and a scope.
|
Gradient(GradientType type,
GradientScope scope)
Creates a gradient by a type and a scope.
|
Modifier and Type | Method and Description |
---|---|
void |
addColorsStartStop(IsColor start,
IsColor stop)
Sets the start and stop color of gradient, when the gradient will have only 2 colors.
|
void |
addColorsStartStop(String start,
String stop)
Sets the start and stop color of gradient, when the gradient will have only 2 colors.
|
void |
addColorStop(double offset,
IsColor color)
Adds a stopping color with its offset
|
void |
addColorStop(double offset,
String color)
Adds a stopping color with its offset
|
void |
addColorStop(GradientColor color)
Adds a stopping color with its offset
|
List<GradientColor> |
getColors()
Returns the unmodifiable list of stopping colors.
|
IsColor |
getInterpolatedColorByOffset(double offset)
Returns a color using the gradient as source of colors.
|
GradientOrientation |
getOrientation()
Returns the gradient orientation.
|
GradientScope |
getScope()
Returns the gradient scope.
|
GradientType |
getType()
Returns the gradient type.
|
getId
checkValue, empty, getArrayValue, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, keys, remove, remove, removeIfExists, setArrayValue, setArrayValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
public Gradient()
topDown
orientation and chart
scope.public Gradient(GradientType type)
chart
scope.type
- gradient typepublic Gradient(GradientType type, GradientOrientation orientation)
chart
scope.type
- gradient typeorientation
- orientation of gradientpublic Gradient(GradientType type, GradientScope scope)
type
- gradient typescope
- scope of gradientpublic Gradient(GradientType type, GradientOrientation orientation, GradientScope scope)
type
- gradient typeorientation
- orientation of gradientscope
- scope of gradientpublic GradientType getType()
public GradientOrientation getOrientation()
public GradientScope getScope()
public void addColorsStartStop(IsColor start, IsColor stop)
start
- starting color, with offset 0stop
- stopping color, with offset 1public void addColorsStartStop(String start, String stop)
start
- starting color, with offset 0stop
- stopping color, with offset 1public void addColorStop(double offset, IsColor color)
offset
- offset of colorcolor
- color instancepublic void addColorStop(double offset, String color)
offset
- offset of colorcolor
- color instancepublic void addColorStop(GradientColor color)
color
- color instancepublic List<GradientColor> getColors()
public IsColor getInterpolatedColorByOffset(double offset)
offset
- offset to search into the gradient colors