Class FractionBasedPainter
java.lang.Object
org.pushingpixels.radiance.theming.api.painter.FractionBasedPainter
- All Implemented Interfaces:
RadianceTrait
- Direct Known Subclasses:
FractionBasedDecorationPainter, FractionBasedOutlinePainter, FractionBasedSurfacePainter
Base painter with fraction-based stops and a color query associated with each
stop. This class allows creating multi-stop gradients with exact control over
which color is used at every gradient control point.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int[]The alphas of this painter.protected ContainerColorTokensSingleColorQuery[]The color queries of this painter.private StringThe display name of this painter.protected float[]The fractions of this painter. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFractionBasedPainter(String displayName, float[] fractions, int[] alphas, ContainerColorTokensSingleColorQuery[] colorQueries) Creates a new fraction-based painter.protectedFractionBasedPainter(String displayName, float[] fractions, ContainerColorTokensSingleColorQuery[] colorQueries) Creates a new fraction-based painter. -
Method Summary
Modifier and TypeMethodDescriptionint[]Returns the color queries of this painter.Returns the display name ofthistrait.float[]Returns the fractions of this painter.private static int[]makeDefaultAlphas(int count)
-
Field Details
-
displayName
The display name of this painter. -
fractions
protected float[] fractionsThe fractions of this painter. If the constructor has not thrown anIllegalArgumentException, the entries in this array are strictly increasing, starting from 0.0 and ending at 1.0. -
alphas
protected int[] alphasThe alphas of this painter. Each entry in this array corresponds to the matching entry infractionsandcolorQueries. Each entry is applied to the matching -
colorQueries
The color queries of this painter. Each entry in this array corresponds to the matching index in thefractions, specifying which color will be used at the relevant gradient control point. If the constructor has not thrown anIllegalArgumentException, the size of this array is identical to the size offractions, and there are nonullentries in this array. Note that the application code can still cause an exception at runtime by throwing it in the implementation of theContainerColorTokensSingleColorQuery.query(ContainerColorTokens)method.
-
-
Constructor Details
-
FractionBasedPainter
protected FractionBasedPainter(String displayName, float[] fractions, ContainerColorTokensSingleColorQuery[] colorQueries) Creates a new fraction-based painter.- Parameters:
displayName- The display name of this painter.fractions- The fractions of this painter. Must be strictly increasing, starting from 0.0 and ending at 1.0.colorQueries- The color queries of this painter. Must have the same size as the fractions array, and all entries must be non-null.
-
FractionBasedPainter
protected FractionBasedPainter(String displayName, float[] fractions, int[] alphas, ContainerColorTokensSingleColorQuery[] colorQueries) Creates a new fraction-based painter.- Parameters:
displayName- The display name of this painter.fractions- The fractions of this painter. Must be strictly increasing, starting from 0.0 and ending at 1.0.alphas- Alpha channels of this painter. Must have the same size as fractions.colorQueries- The color queries of this painter. Must have the same size as the fractions array, and all entries must be non-null.
-
-
Method Details
-
makeDefaultAlphas
private static int[] makeDefaultAlphas(int count) -
getDisplayName
Description copied from interface:RadianceTraitReturns the display name ofthistrait. This method is part of officially supported API.- Specified by:
getDisplayNamein interfaceRadianceTrait- Returns:
- The display name of
thistrait.
-
getFractions
public float[] getFractions()Returns the fractions of this painter.- Returns:
- Fractions of this painter.
-
getAlphas
public int[] getAlphas() -
getColorQueries
Returns the color queries of this painter.- Returns:
- Color queries of this painter.
-