Class LinearGradient
java.lang.Object
com.github.tadukoo.view.paint.gradient.LinearGradient
- All Implemented Interfaces:
Gradient
,SizablePaint
Linear Gradient is used to build a
Gradient
object to use for LinearGradientPaint
.- Since:
- Alpha v.0.2
- Version:
- Alpha v.0.2.1
- Author:
- Logan Ferree (Tadukoo)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The direction for aLinearGradient
to go.static class
Linear Gradient Builder is a builder forLinearGradient
. -
Field Summary
Modifier and TypeFieldDescriptionprotected final Color[]
TheColor
s involved in this LinearGradientprotected final MultipleGradientPaint.ColorSpaceType
Thecolor space
involved in this LinearGradientprotected final MultipleGradientPaint.CycleMethod
Thecycle method
involved in this LinearGradientprotected final LinearGradient.GradientDirection
The direction for this LinearGradient to go.protected final float[]
The fractions involved in this LinearGradientprotected final AffineTransform
TheAffineTransform
involved in this LinearGradientprotected final BiFunction<Dimension,
LinearGradient.GradientDirection, com.github.tadukoo.util.tuple.Pair<Point2D, Point2D>> A function taking in the dimensions of the space and the chosenLinearGradient.GradientDirection
to return the start and end points in space for this LinearGradient -
Constructor Summary
ModifierConstructorDescriptionprivate
LinearGradient
(LinearGradient.GradientDirection direction, BiFunction<Dimension, LinearGradient.GradientDirection, com.github.tadukoo.util.tuple.Pair<Point2D, Point2D>> startAndEndPointsFunc, float[] fractions, Color[] colors, MultipleGradientPaint.CycleMethod cycleMethod, MultipleGradientPaint.ColorSpaceType colorSpace, AffineTransform gradientTransform) Constructs a new Linear Gradient using the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Color[]
float[]
Creates aLinearGradientPaint
using thestartAndEndPointsFunc
to determine the start and end points, and sending the other parameters as specified.BiFunction<Dimension,
LinearGradient.GradientDirection, com.github.tadukoo.util.tuple.Pair<Point2D, Point2D>>
-
Field Details
-
direction
The direction for this LinearGradient to go. This may be ignored by thestartAndEndPointsFunc
-
startAndEndPointsFunc
protected final BiFunction<Dimension,LinearGradient.GradientDirection, startAndEndPointsFunccom.github.tadukoo.util.tuple.Pair<Point2D, Point2D>> A function taking in the dimensions of the space and the chosenLinearGradient.GradientDirection
to return the start and end points in space for this LinearGradient -
fractions
protected final float[] fractionsThe fractions involved in this LinearGradient -
colors
TheColor
s involved in this LinearGradient -
cycleMethod
Thecycle method
involved in this LinearGradient -
colorSpace
Thecolor space
involved in this LinearGradient -
gradientTransform
TheAffineTransform
involved in this LinearGradient
-
-
Constructor Details
-
LinearGradient
private LinearGradient(LinearGradient.GradientDirection direction, BiFunction<Dimension, LinearGradient.GradientDirection, com.github.tadukoo.util.tuple.Pair<Point2D, Point2D>> startAndEndPointsFunc, float[] fractions, Color[] colors, MultipleGradientPaint.CycleMethod cycleMethod, MultipleGradientPaint.ColorSpaceType colorSpace, AffineTransform gradientTransform) Constructs a new Linear Gradient using the given parameters.- Parameters:
direction
- The direction for this LinearGradient to go. This may be ignored by thestartAndEndPointsFunc
startAndEndPointsFunc
- A function taking in the dimensions of the space and the chosenLinearGradient.GradientDirection
to return the start and end points in space for this LinearGradientfractions
- The fractions involved in this LinearGradientcolors
- TheColor
s involved in this LinearGradientcycleMethod
- Thecycle method
involved in this LinearGradientcolorSpace
- Thecolor space
involved in this LinearGradientgradientTransform
- TheAffineTransform
involved in this LinearGradient
-
-
Method Details
-
builder
- Returns:
- A
LinearGradient.LinearGradientBuilder
to use in building a LinearGradient
-
getColors
-
getFractions
public float[] getFractions()- Specified by:
getFractions
in interfaceGradient
- Returns:
- The fractions involved in this Gradient
-
getCycleMethod
- Specified by:
getCycleMethod
in interfaceGradient
- Returns:
- The
cycle method
involved in the Gradient
-
getColorSpace
- Specified by:
getColorSpace
in interfaceGradient
- Returns:
- The
color space
involved in the Gradient
-
getGradientTransform
- Specified by:
getGradientTransform
in interfaceGradient
- Returns:
- The
AffineTransform
involved in the Gradient
-
getDirection
- Returns:
- The direction for this LinearGradient to go. This may be ignored by the
startAndEndPointsFunc
-
getStartAndEndPointsFunc
public BiFunction<Dimension,LinearGradient.GradientDirection, getStartAndEndPointsFunc()com.github.tadukoo.util.tuple.Pair<Point2D, Point2D>> - Returns:
- A function taking in the dimensions of the space and the chosen
LinearGradient.GradientDirection
to return the start and end points in space for this LinearGradient
-
getPaint
Creates aLinearGradientPaint
using thestartAndEndPointsFunc
to determine the start and end points, and sending the other parameters as specified.- Specified by:
getPaint
in interfaceSizablePaint
- Parameters:
size
- The dimensions of the object the Gradient will go on- Returns:
- A new
LinearGradientPaint
using the parameters of this LinearGradient
-