public class LinearGradient
extends java.lang.Object
LinearGradient
cannot be
directly instantiated calling its constructor. New instances are created when native method
initNative(int, int, int, int, int[], int[])
is called from FreeType API. Gradients can then be applied
calling static method setPaint(int, Graphics2D)
.Modifier and Type | Method and Description |
---|---|
static void |
closeNative(int handle)
Closes the given gradient.
|
static int |
initNative(int startX,
int startY,
int endX,
int endY,
int[] fractions,
int[] colors)
Initializes a
LinearGradient . |
static boolean |
setPaint(int handle,
java.awt.Graphics2D g2d)
Tries to set the gradient to the graphic context.
|
static void |
translateNative(int handle,
int x,
int y)
Translates this gradient with the (x, y) vector.
|
public static int initNative(int startX, int startY, int endX, int endY, int[] fractions, int[] colors)
LinearGradient
.
This is the front panel implementation of native method defined in FreeType API. It instantiate a new
LinearGradient
at each call and stores it in a map. The gradient can then be retrieved from its handle.startX
- the x coordinate of the start of the gradientstartY
- the y coordinate of the start of the gradientendX
- the x coordinate of the end of the gradientendY
- the y coordinate of the end of the gradientfractions
- the colors distribution along the gradient from 0 (start) to 255 (end)colors
- the colors in ARGB formatpublic static void translateNative(int handle, int x, int y)
handle
- the handle of the gradient on which the translation is applied.x
- the x coordinate of the translation vector.y
- the y coordinate of the translation vector.public static void closeNative(int handle)
handle
- the handle of the gradient to close.public static boolean setPaint(int handle, java.awt.Graphics2D g2d)
handle
- the gradient handle in native codeg2d
- the graphic context in which the gradient will be paint