public class LinearGradientPaint
- Object
- MultipleGradientPaint
- LinearGradientPaint
ImplementsPaint
LinearGradientPaint provides a way to fill a
Shape with a linear gradient.Constructors
Methods
public final void paint(Graphics g, Rectangle2D bounds) | Paints linear gradient in the given bounds. |
public void paint(Graphics g, double x, double y, double w, double h) | Painds the linear gradient in the given bounds. |
Inherited nested types
Inherited methods
Constructor details
LinearGradientPaint
public LinearGradientPaint(float startX, float startY, float endX, float endY, float[] fractions, int[] colors, MultipleGradientPaint.CycleMethod cycleMethod, MultipleGradientPaint.ColorSpaceType colorSpace, Transform gradientTransform)Creates a LinearGradientPaint with the specified settings.
Parameters
startXfloat- The startX coordinate of the gradient in user space.
startYfloat- The startY coordinate of the gradient in user space.
endXfloat- The endX coordinate of the gradient in user space.
endYfloat- THe endY coordinate of the gradient in user space.
fractionsfloat[]- Fractional positions of where gradient colors begin. Each value should be between 0 and 1.
colorsint[]- The colors to use in the gradient. There should be the same number of colors as there are fractions.
cycleMethodMultipleGradientPaint.CycleMethod- The cycle method to use.
colorSpaceMultipleGradientPaint.ColorSpaceType- The color space to use.
gradientTransformTransform- Transform to use for the gradient. Not used right now.
LinearGradientPaint
public LinearGradientPaint(double startX, double startY, double endX, double endY, float[] fractions, int[] colors, MultipleGradientPaint.CycleMethod cycleMethod, MultipleGradientPaint.ColorSpaceType colorSpace, Transform gradientTransform)Creates a LinearGradientPaint with the specified settings.
Parameters
startXdouble- The startX coordinate of the gradient in user space.
startYdouble- The startY coordinate of the gradient in user space.
endXdouble- The endX coordinate of the gradient in user space.
endYdouble- THe endY coordinate of the gradient in user space.
fractionsfloat[]- Fractional positions of where gradient colors begin. Each value should be between 0 and 1.
colorsint[]- The colors to use in the gradient. There should be the same number of colors as there are fractions.
cycleMethodMultipleGradientPaint.CycleMethod- The cycle method to use.
colorSpaceMultipleGradientPaint.ColorSpaceType- The color space to use.
gradientTransformTransform- Transform to use for the gradient. Not used right now.
Method details
paint
public final void paint(Graphics g, Rectangle2D bounds)Paints linear gradient in the given bounds.
paint
public void paint(Graphics g, double x, double y, double w, double h)Painds the linear gradient in the given bounds.