public final class CssDimensionParsingUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
determinePositionBetweenValueAndUnit(String string)
Method used in preparation of splitting a string containing a numeric value with a metric unit (e.g.
|
static float |
parseAbsoluteFontSize(String fontSizeValue)
Parses the absolute font size.
|
static float |
parseAbsoluteFontSize(String fontSizeValue,
String defaultMetric)
Parses the absolute font size.
|
static float |
parseAbsoluteLength(String length)
Parses the absolute length.
|
static float |
parseAbsoluteLength(String length,
String defaultMetric)
Parses a length with an allowed metric unit (px, pt, in, cm, mm, pc, q) or numeric value (e.g.
|
static float |
parseAngle(String angle)
Parses a angle with an allowed metric unit (deg, grad, rad) or numeric value (e.g.
|
static float |
parseAngle(String angle,
String defaultMetric)
Parses an angle with an allowed metric unit (deg, grad, rad) or numeric value (e.g.
|
static int[] |
parseAspectRatio(String str)
Parses an aspect ratio into an array with two integers.
|
static TransparentColor |
parseColor(String colorValue)
Parses either RGBA or CMYK color.
|
static Double |
parseDouble(String str)
Parses a double without throwing an exception if something goes wrong.
|
static Float |
parseFloat(String str)
Parses a float without throwing an exception if something goes wrong.
|
static Integer |
parseInteger(String str)
Parses an integer without throwing an exception if something goes wrong.
|
static UnitValue |
parseLengthValueToPt(String value,
float emValue,
float remValue)
Convenience method for parsing a value to pt.
|
static float |
parseRelativeFontSize(String relativeFontSizeValue,
float baseValue)
Parses the relative font size.
|
static float |
parseRelativeValue(String relativeValue,
float baseValue)
Parses an relative value based on the base value that was given, in the metric unit of the base value.
(e.g. |
static float |
parseResolution(String resolutionStr)
Parses the resolution.
|
static float[] |
parseRgbaColor(String colorValue)
Parses the RGBA color.
|
static UnitValue[] |
parseSpecificCornerBorderRadius(String specificBorderRadius,
float emValue,
float remValue)
Parses the border radius of specific corner.
|
public static Integer parseInteger(String str)
str - a string that might be an integer valuepublic static Float parseFloat(String str)
str - a string that might be a float valuepublic static Double parseDouble(String str)
str - a string that might be a double valuepublic static float parseAngle(String angle, String defaultMetric)
angle - String containing the angle to parsedefaultMetric - default metric to use in case the input string does not specify a metricpublic static float parseAngle(String angle)
angle - String containing the angle to parsepublic static int[] parseAspectRatio(String str)
str - a string that might contain two integer valuespublic static float parseAbsoluteLength(String length, String defaultMetric)
length - the string containing the lengthdefaultMetric - the string containing the metric if it is possible that the length string does not contain
one. If null the length is considered to be in px as is default in HTML/CSSpublic static float parseAbsoluteLength(String length)
length - the length as a stringpublic static float parseRelativeValue(String relativeValue, float baseValue)
relativeValue - in %, em or exbaseValue - the value the returned float is based onpublic static UnitValue parseLengthValueToPt(String value, float emValue, float remValue)
value - the valueemValue - the em valueremValue - the root em valuepublic static float parseAbsoluteFontSize(String fontSizeValue, String defaultMetric)
A numeric value (without px, pt, etc in the given length string) is considered to be in the default metric that was given.
fontSizeValue - the font size value as a StringdefaultMetric - the string containing the metric if it is possible that the length string does not contain
one. If null the length is considered to be in px as is default in HTML/CSS.floatpublic static float parseAbsoluteFontSize(String fontSizeValue)
A numeric value (without px, pt, etc in the given length string) is considered to be in the px.
fontSizeValue - the font size value as a Stringfloatpublic static float parseRelativeFontSize(String relativeFontSizeValue, float baseValue)
relativeFontSizeValue - the relative font size value as a StringbaseValue - the base valuefloatpublic static UnitValue[] parseSpecificCornerBorderRadius(String specificBorderRadius, float emValue, float remValue)
specificBorderRadius - string that defines the border radius of specific corneremValue - the em valueremValue - the root em valueUnitValues that define horizontal and vertical border radius valuespublic static float parseResolution(String resolutionStr)
resolutionStr - the resolution as a stringpublic static TransparentColor parseColor(String colorValue)
colorValue - the color valuepublic static float[] parseRgbaColor(String colorValue)
colorValue - the color valuepublic static int determinePositionBetweenValueAndUnit(String string)
string - containing a numeric value with a metric unitCopyright © 1998–2024 Apryse Group NV. All rights reserved.