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
Nested ClassesModifier and TypeClassDescriptionstatic enumThe direction for aLinearGradientto go.static classLinear Gradient Builder is a builder forLinearGradient. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Color[]TheColors involved in this LinearGradientprotected final MultipleGradientPaint.ColorSpaceTypeThecolor spaceinvolved in this LinearGradientprotected final MultipleGradientPaint.CycleMethodThecycle methodinvolved in this LinearGradientprotected final LinearGradient.GradientDirectionThe direction for this LinearGradient to go.protected final float[]The fractions involved in this LinearGradientprotected final AffineTransformTheAffineTransforminvolved 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.GradientDirectionto return the start and end points in space for this LinearGradient -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateLinearGradient(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 aLinearGradientPaintusing thestartAndEndPointsFuncto 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.GradientDirectionto return the start and end points in space for this LinearGradient -
fractions
protected final float[] fractionsThe fractions involved in this LinearGradient -
colors
TheColors involved in this LinearGradient -
cycleMethod
Thecycle methodinvolved in this LinearGradient -
colorSpace
Thecolor spaceinvolved in this LinearGradient -
gradientTransform
TheAffineTransforminvolved 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 thestartAndEndPointsFuncstartAndEndPointsFunc- A function taking in the dimensions of the space and the chosenLinearGradient.GradientDirectionto return the start and end points in space for this LinearGradientfractions- The fractions involved in this LinearGradientcolors- TheColors involved in this LinearGradientcycleMethod- Thecycle methodinvolved in this LinearGradientcolorSpace- Thecolor spaceinvolved in this LinearGradientgradientTransform- TheAffineTransforminvolved in this LinearGradient
-
-
Method Details
-
builder
- Returns:
- A
LinearGradient.LinearGradientBuilderto use in building a LinearGradient
-
getColors
-
getFractions
public float[] getFractions()- Specified by:
getFractionsin interfaceGradient- Returns:
- The fractions involved in this Gradient
-
getCycleMethod
- Specified by:
getCycleMethodin interfaceGradient- Returns:
- The
cycle methodinvolved in the Gradient
-
getColorSpace
- Specified by:
getColorSpacein interfaceGradient- Returns:
- The
color spaceinvolved in the Gradient
-
getGradientTransform
- Specified by:
getGradientTransformin interfaceGradient- Returns:
- The
AffineTransforminvolved 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.GradientDirectionto return the start and end points in space for this LinearGradient
-
getPaint
Creates aLinearGradientPaintusing thestartAndEndPointsFuncto determine the start and end points, and sending the other parameters as specified.- Specified by:
getPaintin interfaceSizablePaint- Parameters:
size- The dimensions of the object the Gradient will go on- Returns:
- A new
LinearGradientPaintusing the parameters of this LinearGradient
-