Class Length

java.lang.Object
com.github.weisj.jsvg.geometry.size.Length
All Implemented Interfaces:
LengthValue

public final class Length extends Object implements LengthValue
  • Field Details

    • UNSPECIFIED_RAW

      public static final float UNSPECIFIED_RAW
      See Also:
    • 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:
    • INCHES_PER_CM

      private static final float INCHES_PER_CM
      See Also:
  • Constructor Details

    • Length

      public Length(@NotNull @NotNull Unit unit, float value)
    • Length

      public Length(@NotNull @NotNull Length ry)
  • Method Details

    • 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 interface LengthValue
      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 String toString()
      Overrides:
      toString in class Object
    • isZero

      public boolean isZero()
    • isConstantlyZero

      public boolean isConstantlyZero()
      Specified by:
      isConstantlyZero in interface LengthValue
    • isConstantlyNonNegative

      public boolean isConstantlyNonNegative()
      Specified by:
      isConstantlyNonNegative in interface LengthValue
    • 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(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object