- 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 float
INCHES_PER_CM
static @NotNull Length
INHERITED
static @NotNull Length
ONE
private static float
PIXELS_PER_INCH
private @NotNull Unit
unit
static @NotNull Length
UNSPECIFIED
static float
UNSPECIFIED_RAW
private float
value
static @NotNull Length
ZERO
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull Length
coerceNonNegative()
@NotNull Length
coercePercentageToCorrectUnit(@NotNull UnitType unitType, @NotNull PercentageDimension dimension)
boolean
equals(java.lang.Object o)
int
hashCode()
boolean
isAbsolute()
boolean
isConstantlyNonNegative()
boolean
isConstantlyZero()
boolean
isSpecified()
static boolean
isSpecified(float value)
boolean
isUnspecified()
static boolean
isUnspecified(float value)
boolean
isZero()
@NotNull Length
multiply(float scalingFactor)
@NotNull Length
orElseIfUnspecified(float value)
float
raw()
float
resolve(@NotNull MeasureContext context)
Resolve the length to its effective value.float
resolveFontSize(@NotNull MeasureContext context)
Used for resolving font sizes.private static float
resolveNonPercentage(@NotNull MeasureContext context, Unit unit, float value)
@NotNull java.lang.String
toString()
@NotNull Unit
unit()
-
-
-
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:LengthValue
Resolve the length to its effective value.- Specified by:
resolve
in 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:
toString
in classjava.lang.Object
-
isZero
public boolean isZero()
-
isConstantlyZero
public boolean isConstantlyZero()
- Specified by:
isConstantlyZero
in interfaceLengthValue
-
isConstantlyNonNegative
public boolean isConstantlyNonNegative()
- Specified by:
isConstantlyNonNegative
in 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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-