java.lang.Object
com.github.weisj.jsvg.geometry.size.Length

@Immutable public final class Length extends Object
  • 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
    • unit

      @NotNull private final @NotNull Unit unit
    • value

      private final float value
    • pixelsPerInch

      private static final float pixelsPerInch
      See Also:
    • inchesPerCm

      private static final float inchesPerCm
      See Also:
  • Constructor Details

    • Length

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

    • isUnspecified

      public static boolean isUnspecified(float value)
    • isSpecified

      public static boolean isSpecified(float value)
    • resolveNonPercentage

      private float resolveNonPercentage(@NotNull @NotNull MeasureContext context)
    • resolveWidth

      public float resolveWidth(@NotNull @NotNull MeasureContext context)
      Used for resolving lengths which are used as x-coordinates or width values.
      Parameters:
      context - the measuring context.
      Returns:
      the resolved size.
    • resolveHeight

      public float resolveHeight(@NotNull @NotNull MeasureContext context)
      Used for resolving lengths which are used as y-coordinates or height values.
      Parameters:
      context - the measuring context.
      Returns:
      the resolved size.
    • resolveLength

      public float resolveLength(@NotNull @NotNull MeasureContext context)
      Used for resolving lengths which are neither used as y/x-coordinates nor width/height values. Relative sizes are relative to the ViewBox.normedDiagonalLength().
      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

      public String toString()
      Overrides:
      toString in class Object
    • isZero

      public boolean isZero()
    • 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)
    • orElseIfUnspecified

      public Length orElseIfUnspecified(float value)
    • multiply

      public Length multiply(float scalingFactor)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object