Class CssGradientUtil
java.lang.Object
com.itextpdf.styledxmlparser.css.util.CssGradientUtil
Utilities class for CSS gradient functions parsing.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
addStopColors
(AbstractLinearGradientBuilder builder, List<String> argumentsList, int stopsStartIndex, float emValue, float remValue) private static GradientColorStop
createStopColor
(float[] rgba, UnitValue offset) static boolean
isCssLinearGradientValue
(String cssValue) Checks whether the provided value is a linear gradient or repeating linear gradient function.parseCssLinearGradient
(String cssGradientValue, float emValue, float remValue) Parses the provided linear gradient or repeating linear gradient functionprivate static StrategyBasedLinearGradientBuilder
parseCssLinearGradient
(List<String> argumentsList, boolean isRepeating, float emValue, float remValue) private static StrategyBasedLinearGradientBuilder.GradientStrategy
parseDirection
(String argument)
-
Field Details
-
LINEAR_GRADIENT_FUNCTION_SUFFIX
- See Also:
-
REPEATING_LINEAR_GRADIENT_FUNCTION_SUFFIX
- See Also:
-
-
Constructor Details
-
CssGradientUtil
private CssGradientUtil()
-
-
Method Details
-
isCssLinearGradientValue
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:
true
if the provided argument is the linear gradient or repeating linear gradient function (even if the arguments list is invalid)
-
parseCssLinearGradient
public static StrategyBasedLinearGradientBuilder parseCssLinearGradient(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
StrategyBasedLinearGradientBuilder
constructed from the parsed linear gradient ornull
if 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(List<String> argumentsList, boolean isRepeating, float emValue, float remValue) -
addStopColors
private static void addStopColors(AbstractLinearGradientBuilder builder, List<String> argumentsList, int stopsStartIndex, float emValue, float remValue) -
parseDirection
-
createStopColor
-