Class Length

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class Length extends ProxyInstance

RsvgLength values are used in Handle.getIntrinsicDimensions(Out, Length, Out, Length, Out, Rectangle), for example, to return the CSS length values of the width and height attributes of an <svg> element.

This is equivalent to CSS lengths.

It is up to the calling application to convert lengths in non-pixel units (i.e. those where the unit field is not RSVG_UNIT_PX) into something meaningful to the application. For example, if your application knows the dots-per-inch (DPI) it is using, it can convert lengths with unit in RSVG_UNIT_IN or other physical units.

  • Constructor Details

    • Length

      public Length(MemorySegment address)
      Create a Length proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • Length

      public Length(Arena arena)
      Allocate a new Length.
      Parameters:
      arena - to control the memory allocation scope
    • Length

      public Length()
      Allocate a new Length. The memory is allocated with Arena.ofAuto().
    • Length

      public Length(double length, Unit unit, Arena arena)
      Allocate a new Length with the fields set to the provided values.
      Parameters:
      length - value for the field length
      unit - value for the field unit
      arena - to control the memory allocation scope
    • Length

      public Length(double length, Unit unit)
      Allocate a new Length with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      length - value for the field length
      unit - value for the field unit
  • Method Details

    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • readLength

      public double readLength()
      Read the value of the field length.
      Returns:
      The value of the field length
    • writeLength

      public void writeLength(double length)
      Write a value in the field length.
      Parameters:
      length - The new value for the field length
    • readUnit

      public Unit readUnit()
      Read the value of the field unit.
      Returns:
      The value of the field unit
    • writeUnit

      public void writeUnit(Unit unit)
      Write a value in the field unit.
      Parameters:
      unit - The new value for the field unit