Class CssGradientUtil
- java.lang.Object
-
- com.itextpdf.styledxmlparser.css.util.CssGradientUtil
-
public final class CssGradientUtil extends java.lang.ObjectUtilities class for CSS gradient functions parsing.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringLINEAR_GRADIENT_FUNCTION_SUFFIXprivate static java.lang.StringREPEATING_LINEAR_GRADIENT_FUNCTION_SUFFIX
-
Constructor Summary
Constructors Modifier Constructor Description privateCssGradientUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidaddStopColors(AbstractLinearGradientBuilder builder, java.util.List<java.lang.String> argumentsList, int stopsStartIndex, float emValue, float remValue)private static GradientColorStopcreateStopColor(float[] rgba, UnitValue offset)static booleanisCssLinearGradientValue(java.lang.String cssValue)Checks whether the provided value is a linear gradient or repeating linear gradient function.static StrategyBasedLinearGradientBuilderparseCssLinearGradient(java.lang.String cssGradientValue, float emValue, float remValue)Parses the provided linear gradient or repeating linear gradient functionprivate static StrategyBasedLinearGradientBuilderparseCssLinearGradient(java.util.List<java.lang.String> argumentsList, boolean isRepeating, float emValue, float remValue)private static StrategyBasedLinearGradientBuilder.GradientStrategyparseDirection(java.lang.String argument)
-
-
-
Field Detail
-
LINEAR_GRADIENT_FUNCTION_SUFFIX
private static final java.lang.String LINEAR_GRADIENT_FUNCTION_SUFFIX
- See Also:
- Constant Field Values
-
REPEATING_LINEAR_GRADIENT_FUNCTION_SUFFIX
private static final java.lang.String REPEATING_LINEAR_GRADIENT_FUNCTION_SUFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
isCssLinearGradientValue
public static boolean isCssLinearGradientValue(java.lang.String cssValue)
Checks whether the provided value is a linear gradient or repeating linear gradient function. This method does not check the validity of arguments list.- Parameters:
cssValue- the value to check- Returns:
trueif the provided argument is the linear gradient or repeating linear gradient function (even if the arguments list is invalid)
-
parseCssLinearGradient
public static StrategyBasedLinearGradientBuilder parseCssLinearGradient(java.lang.String cssGradientValue, float emValue, float remValue)
Parses the provided linear gradient or repeating linear gradient function- Parameters:
cssGradientValue- the value to parseemValue- the current element's em valueremValue- the current element's rem value- Returns:
- the
StrategyBasedLinearGradientBuilderconstructed from the parsed linear gradient ornullif the argument value is not a linear gradient or repeating linear gradient function - Throws:
StyledXMLParserException- if the provided argument is a linear gradient or repeating linear gradient function, but the arguments list is invalid
-
parseCssLinearGradient
private static StrategyBasedLinearGradientBuilder parseCssLinearGradient(java.util.List<java.lang.String> argumentsList, boolean isRepeating, float emValue, float remValue)
-
addStopColors
private static void addStopColors(AbstractLinearGradientBuilder builder, java.util.List<java.lang.String> argumentsList, int stopsStartIndex, float emValue, float remValue)
-
parseDirection
private static StrategyBasedLinearGradientBuilder.GradientStrategy parseDirection(java.lang.String argument)
-
createStopColor
private static GradientColorStop createStopColor(float[] rgba, UnitValue offset)
-
-