- java.lang.Object
-
- com.github.weisj.jsvg.geometry.size.Length
-
- All Implemented Interfaces:
LengthValue
public final class Length extends java.lang.Object implements LengthValue
-
-
Field Summary
Fields Modifier and Type Field Description private static floatINCHES_PER_CMstatic @NotNull LengthINHERITEDstatic @NotNull LengthONEprivate static floatPIXELS_PER_INCHprivate @NotNull Unitunitstatic @NotNull LengthUNSPECIFIEDstatic floatUNSPECIFIED_RAWprivate floatvaluestatic @NotNull LengthZERO
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull LengthcoerceNonNegative()@NotNull LengthcoercePercentageToCorrectUnit(@NotNull UnitType unitType, @NotNull PercentageDimension dimension)booleanequals(java.lang.Object o)inthashCode()booleanisAbsolute()booleanisConstantlyNonNegative()booleanisConstantlyZero()booleanisSpecified()static booleanisSpecified(float value)booleanisUnspecified()static booleanisUnspecified(float value)booleanisZero()@NotNull Lengthmultiply(float scalingFactor)@NotNull LengthorElseIfUnspecified(float value)floatraw()floatresolve(@NotNull MeasureContext context)Resolve the length to its effective value.floatresolveFontSize(@NotNull MeasureContext context)Used for resolving font sizes.private static floatresolveNonPercentage(@NotNull MeasureContext context, Unit unit, float value)@NotNull java.lang.StringtoString()@NotNull Unitunit()
-
-
-
Field Detail
-
UNSPECIFIED_RAW
public static final float UNSPECIFIED_RAW
- See Also:
- Constant Field Values
-
UNSPECIFIED
@NotNull public static final @NotNull Length UNSPECIFIED
-
ZERO
@NotNull public static final @NotNull Length ZERO
-
ONE
@NotNull public static final @NotNull Length ONE
-
INHERITED
@NotNull public static final @NotNull Length INHERITED
-
unit
@NotNull private final @NotNull Unit unit
-
value
private final float value
-
PIXELS_PER_INCH
private static final float PIXELS_PER_INCH
- See Also:
- Constant Field Values
-
INCHES_PER_CM
private static final float INCHES_PER_CM
- See Also:
- Constant Field Values
-
-
Method Detail
-
isUnspecified
public static boolean isUnspecified(float value)
-
isSpecified
public static boolean isSpecified(float value)
-
resolveNonPercentage
private static float resolveNonPercentage(@NotNull @NotNull MeasureContext context, Unit unit, float value)
-
resolve
public float resolve(@NotNull @NotNull MeasureContext context)Description copied from interface:LengthValueResolve the length to its effective value.- Specified by:
resolvein interfaceLengthValue- Parameters:
context- the measuring context.- Returns:
- the resolved size.
-
resolveFontSize
public float resolveFontSize(@NotNull @NotNull MeasureContext context)Used for resolving font sizes. Relative values will be resolves with respect to the current font size. This isn't dependent on the current viewBox.- Parameters:
context- the measuring context.- Returns:
- the resolved size.
-
toString
@NotNull public @NotNull java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isZero
public boolean isZero()
-
isConstantlyZero
public boolean isConstantlyZero()
- Specified by:
isConstantlyZeroin interfaceLengthValue
-
isConstantlyNonNegative
public boolean isConstantlyNonNegative()
- Specified by:
isConstantlyNonNegativein interfaceLengthValue
-
isAbsolute
public boolean isAbsolute()
-
raw
public float raw()
-
unit
@NotNull public @NotNull Unit unit()
-
isUnspecified
public boolean isUnspecified()
-
isSpecified
public boolean isSpecified()
-
coerceNonNegative
@NotNull public @NotNull Length coerceNonNegative()
-
coercePercentageToCorrectUnit
@NotNull public @NotNull Length coercePercentageToCorrectUnit(@NotNull @NotNull UnitType unitType, @NotNull @NotNull PercentageDimension dimension)
-
orElseIfUnspecified
@NotNull public @NotNull Length orElseIfUnspecified(float value)
-
multiply
@NotNull public @NotNull Length multiply(float scalingFactor)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-