Class LinearGradientPaint
- All Implemented Interfaces:
Paint
Shape with a linear gradient.-
Nested Class Summary
Nested classes/interfaces inherited from class MultipleGradientPaint
MultipleGradientPaint.ColorSpaceType, MultipleGradientPaint.CycleMethod -
Constructor Summary
ConstructorsConstructorDescriptionLinearGradientPaint(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.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. -
Method Summary
Modifier and TypeMethodDescriptionvoidPainds the linear gradient in the given bounds.final voidpaint(Graphics g, Rectangle2D bounds) Paints linear gradient in the given bounds.Methods inherited from class MultipleGradientPaint
getColors, getColorSpace, getCycleMethod, getFractions, getTransform, getTransparency, setColors, setColorSpace, setCycleMethod, setFractions, setTransform, setTransparency
-
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: The startX coordinate of the gradient in user space. -
startY: The startY coordinate of the gradient in user space. -
endX: The endX coordinate of the gradient in user space. -
endY: THe endY coordinate of the gradient in user space. -
fractions: Fractional positions of where gradient colors begin. Each value should be between 0 and 1. -
colors: The colors to use in the gradient. There should be the same number of colors as there are fractions. -
cycleMethod: The cycle method to use. -
colorSpace: The color space to use. -
gradientTransform: 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: The startX coordinate of the gradient in user space. -
startY: The startY coordinate of the gradient in user space. -
endX: The endX coordinate of the gradient in user space. -
endY: THe endY coordinate of the gradient in user space. -
fractions: Fractional positions of where gradient colors begin. Each value should be between 0 and 1. -
colors: The colors to use in the gradient. There should be the same number of colors as there are fractions. -
cycleMethod: The cycle method to use. -
colorSpace: The color space to use. -
gradientTransform: Transform to use for the gradient. Not used right now.
-
-
-
Method Details
-
paint
Paints linear gradient in the given bounds.
Parameters
-
g -
bounds
-
-
paint
Painds the linear gradient in the given bounds.
Parameters
-
g -
x -
y -
w -
h
-
-