public final class GradientBuilder extends Object
Linear
or Radial
.CANVAS
or CHART
area.Modifier and Type | Method and Description |
---|---|
GradientBuilder |
addColorsStartStop(IsColor start,
IsColor stop)
Sets the start and stop color of gradient, when the gradient will have only 2 colors.
|
GradientBuilder |
addColorsStartStop(String start,
String stop)
Sets the start and stop color of gradient, when the gradient will have only 2 colors.
|
GradientBuilder |
addColorStop(double offset,
IsColor color)
Adds a stopping color with its offset
|
GradientBuilder |
addColorStop(double offset,
String color)
Adds a stopping color with its offset
|
GradientBuilder |
addColorStop(GradientColor color)
Adds a stopping color with its offset
|
Gradient |
build()
Builds and returns a gradient instance.
|
static Gradient |
build(NativeObject nativeObject)
Creates a gradient, previously stored in the a native java script object.
|
static GradientBuilder |
create()
Creates a LINEAR gradient, with
topDown orientation and chart scope. |
static GradientBuilder |
create(GradientType type)
Creates a gradient by a type, with
chart scope. |
static GradientBuilder |
create(GradientType type,
GradientOrientation orientation)
Creates a gradient by a type and an orientation, with
chart scope. |
static GradientBuilder |
create(GradientType type,
GradientOrientation orientation,
GradientScope scope)
Creates a gradient by a type, an orientation and a scope.
|
static GradientBuilder |
create(GradientType type,
GradientScope scope)
Creates a gradient by a type and a scope.
|
static Gradient |
retrieve(CanvasGradientItem canvasGradient)
Retrieves a cached pattern by a
CanvasGradientItem instance.If the pattern doesn't exist, returns null . |
GradientBuilder |
setColors(IsColor... colors)
Sets an array of colors to the gradient.
|
GradientBuilder |
setColors(List<IsColor> colors)
Sets the list of colors.
|
public static GradientBuilder create()
topDown
orientation and chart
scope.public static GradientBuilder create(GradientType type)
chart
scope.type
- gradient typepublic static GradientBuilder create(GradientType type, GradientOrientation orientation)
chart
scope.type
- gradient typeorientation
- orientation of gradientpublic static GradientBuilder create(GradientType type, GradientScope scope)
type
- gradient typescope
- scope of gradientpublic static GradientBuilder create(GradientType type, GradientOrientation orientation, GradientScope scope)
type
- gradient typeorientation
- orientation of gradientscope
- scope of gradientpublic GradientBuilder addColorsStartStop(IsColor start, IsColor stop)
start
- starting color, with offset 0stop
- stopping color, with offset 1public GradientBuilder addColorsStartStop(String start, String stop)
start
- starting color, with offset 0stop
- stopping color, with offset 1public GradientBuilder addColorStop(double offset, IsColor color)
offset
- offset of colorcolor
- color instancepublic GradientBuilder addColorStop(double offset, String color)
offset
- offset of colorcolor
- color instancepublic GradientBuilder addColorStop(GradientColor color)
color
- color instancepublic GradientBuilder setColors(IsColor... colors)
colors
- colors array to setpublic GradientBuilder setColors(List<IsColor> colors)
colors
- colors list to setpublic Gradient build()
public static Gradient build(NativeObject nativeObject)
nativeObject
- native java script object wrapped by gradient.public static Gradient retrieve(CanvasGradientItem canvasGradient)
CanvasGradientItem
instance.null
.canvasGradient
- the canvas gradient to use for searchingCanvasGradientItem
instance.null