public class LinearGradientPaint

  1. Object
  2. MultipleGradientPaint
  3. LinearGradientPaint

ImplementsPaint

LinearGradientPaint provides a way to fill a Shape with a linear gradient.

Constructors

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.
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.

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

startX float
The startX coordinate of the gradient in user space.
startY float
The startY coordinate of the gradient in user space.
endX float
The endX coordinate of the gradient in user space.
endY float
THe endY coordinate of the gradient in user space.
fractions float[]
Fractional positions of where gradient colors begin. Each value should be between 0 and 1.
colors int[]
The colors to use in the gradient. There should be the same number of colors as there are fractions.
cycleMethod MultipleGradientPaint.CycleMethod
The cycle method to use.
colorSpace MultipleGradientPaint.ColorSpaceType
The color space to use.
gradientTransform Transform
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

startX double
The startX coordinate of the gradient in user space.
startY double
The startY coordinate of the gradient in user space.
endX double
The endX coordinate of the gradient in user space.
endY double
THe endY coordinate of the gradient in user space.
fractions float[]
Fractional positions of where gradient colors begin. Each value should be between 0 and 1.
colors int[]
The colors to use in the gradient. There should be the same number of colors as there are fractions.
cycleMethod MultipleGradientPaint.CycleMethod
The cycle method to use.
colorSpace MultipleGradientPaint.ColorSpaceType
The color space to use.
gradientTransform Transform
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.