Class GradientBuilder<GradientType extends Gradient>
java.lang.Object
com.github.tadukoo.view.paint.gradient.GradientBuilder<GradientType>
- Direct Known Subclasses:
LinearGradient.LinearGradientBuilder
,RadialGradient.RadialGradientBuilder
Gradient Builder is an abstract builder for a
Gradient
to be extended by subclasses for making more
specific Gradients, e.g. LinearGradient
.- Since:
- Alpha v.0.2
- Version:
- Alpha v.0.2.1
- Author:
- Logan Ferree (Tadukoo)
-
Field Summary
Modifier and TypeFieldDescriptionTheColor
s involved in the Gradientprotected MultipleGradientPaint.ColorSpaceType
Thecolor space
involved in the Gradientprotected MultipleGradientPaint.CycleMethod
Thecycle method
involved in the GradientThe fractions involved in the Gradientprotected AffineTransform
TheAffineTransform
involved in the Gradient -
Constructor Summary
ModifierConstructorDescriptionprotected
Constructs a new GradientBuilder (to be called in subclasses) -
Method Summary
Modifier and TypeMethodDescriptionfinal GradientType
build()
Builds the Gradient after checking for errors.protected abstract GradientType
Builds the actualGradient
.protected final void
Used to verify the given parameters for the Gradient to ensure nothing went wrong.Called bycheckForErrors()
when checking errors so subclasses can check for their own specific errors.colorPoint
(float fraction, Color color) colorSpace
(MultipleGradientPaint.ColorSpaceType colorSpace) cycleMethod
(MultipleGradientPaint.CycleMethod cycleMethod) gradientTransform
(AffineTransform gradientTransform)
-
Field Details
-
fractions
The fractions involved in the Gradient -
colors
TheColor
s involved in the Gradient -
cycleMethod
Thecycle method
involved in the Gradient -
colorSpace
Thecolor space
involved in the Gradient -
gradientTransform
TheAffineTransform
involved in the Gradient
-
-
Constructor Details
-
GradientBuilder
protected GradientBuilder()Constructs a new GradientBuilder (to be called in subclasses)
-
-
Method Details
-
colorPoint
- Parameters:
fraction
- The fraction to use for this color pointcolor
- TheColor
to use for this color point- Returns:
- this, to continue building
-
cycleMethod
- Parameters:
cycleMethod
- Thecycle method
involved in the Gradient- Returns:
- this, to continue building
-
colorSpace
- Parameters:
colorSpace
- Thecolor space
involved in the Gradient- Returns:
- this, to continue building
-
gradientTransform
- Parameters:
gradientTransform
- TheAffineTransform
involved in the Gradient- Returns:
- this, to continue building
-
checkForErrors
protected final void checkForErrors()Used to verify the given parameters for the Gradient to ensure nothing went wrong.- Throws:
IllegalArgumentException
- If there are any errors
-
checkForSubclassErrors
Called bycheckForErrors()
when checking errors so subclasses can check for their own specific errors.- Returns:
- A List of errors, which may be empty - it must not be null
-
build
Builds the Gradient after checking for errors.- Returns:
- The newly created
Gradient
-
buildGradient
Builds the actualGradient
. This is implemented by the specific subclass.- Returns:
- The newly built
Gradient
-