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
FieldsModifier and TypeFieldDescriptionTheColors involved in the Gradientprotected MultipleGradientPaint.ColorSpaceTypeThecolor spaceinvolved in the Gradientprotected MultipleGradientPaint.CycleMethodThecycle methodinvolved in the GradientThe fractions involved in the Gradientprotected AffineTransformTheAffineTransforminvolved in the Gradient -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a new GradientBuilder (to be called in subclasses) -
Method Summary
Modifier and TypeMethodDescriptionfinal GradientTypebuild()Builds the Gradient after checking for errors.protected abstract GradientTypeBuilds the actualGradient.protected final voidUsed 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
TheColors involved in the Gradient -
cycleMethod
Thecycle methodinvolved in the Gradient -
colorSpace
Thecolor spaceinvolved in the Gradient -
gradientTransform
TheAffineTransforminvolved 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- TheColorto use for this color point- Returns:
- this, to continue building
-
cycleMethod
- Parameters:
cycleMethod- Thecycle methodinvolved in the Gradient- Returns:
- this, to continue building
-
colorSpace
- Parameters:
colorSpace- Thecolor spaceinvolved in the Gradient- Returns:
- this, to continue building
-
gradientTransform
- Parameters:
gradientTransform- TheAffineTransforminvolved 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
-