Class Size

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class Size extends ProxyInstance
A size.
Since:
1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Allocate a new Size.
    Size(float width, float height)
    Allocate a new Size with the fields set to the provided values.
    Size(float width, float height, Arena arena)
    Allocate a new Size with the fields set to the provided values.
    Size(Arena arena)
    Allocate a new Size.
    Create a Size proxy instance for the provided memory address.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Size
    Allocates a new graphene_size_t.
    boolean
    Checks whether the two give graphene_size_t are equal.
    void
    Frees the resources allocated by graphene_size_alloc().
    The memory layout of the native struct.
    static @Nullable Type
    Get the GType of the Size class.
    init(float width, float height)
    Initializes a graphene_size_t using the given width and height.
    Initializes a graphene_size_t using the width and height of the given src.
    void
    interpolate(Size b, double factor, Size res)
    Linearly interpolates the two given graphene_size_t using the given interpolation factor.
    float
    Read the value of the field height.
    float
    Read the value of the field width.
    void
    scale(float factor, Size res)
    Scales the components of a graphene_size_t using the given factor.
    void
    writeHeight(float height)
    Write a value in the field height.
    void
    writeWidth(float width)
    Write a value in the field width.
    static Size
    A constant pointer to a zero graphene_size_t, useful for equality checks and interpolations.

    Methods inherited from class ProxyInstance

    equals, handle, hashCode

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Size

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

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

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

      public Size(float width, float height, Arena arena)
      Allocate a new Size with the fields set to the provided values.
      Parameters:
      width - value for the field width
      height - value for the field height
      arena - to control the memory allocation scope
    • Size

      public Size(float width, float height)
      Allocate a new Size with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      width - value for the field width
      height - value for the field height
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the Size class.
      Returns:
      the GType
    • getMemoryLayout

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

      public float readWidth()
      Read the value of the field width.
      Returns:
      The value of the field width
    • writeWidth

      public void writeWidth(float width)
      Write a value in the field width.
      Parameters:
      width - The new value for the field width
    • readHeight

      public float readHeight()
      Read the value of the field height.
      Returns:
      The value of the field height
    • writeHeight

      public void writeHeight(float height)
      Write a value in the field height.
      Parameters:
      height - The new value for the field height
    • alloc

      public static Size alloc()

      Allocates a new graphene_size_t.

      The contents of the returned value are undefined.

      Returns:
      the newly allocated graphene_size_t
      Since:
      1.0
    • zero

      public static Size zero()
      A constant pointer to a zero graphene_size_t, useful for equality checks and interpolations.
      Returns:
      a constant size
      Since:
      1.0
    • equal

      public boolean equal(Size b)
      Checks whether the two give graphene_size_t are equal.
      Parameters:
      b - a graphene_size_t
      Returns:
      true if the sizes are equal
      Since:
      1.0
    • free

      public void free()
      Frees the resources allocated by graphene_size_alloc().
      Since:
      1.0
    • init

      public Size init(float width, float height)
      Initializes a graphene_size_t using the given width and height.
      Parameters:
      width - the width
      height - the height
      Returns:
      the initialized graphene_size_t
      Since:
      1.0
    • initFromSize

      public Size initFromSize(Size src)
      Initializes a graphene_size_t using the width and height of the given src.
      Parameters:
      src - a graphene_size_t
      Returns:
      the initialized graphene_size_t
      Since:
      1.0
    • interpolate

      public void interpolate(Size b, double factor, Size res)
      Linearly interpolates the two given graphene_size_t using the given interpolation factor.
      Parameters:
      b - a graphene_size_t
      factor - the linear interpolation factor
      res - return location for the interpolated size
      Since:
      1.0
    • scale

      public void scale(float factor, Size res)
      Scales the components of a graphene_size_t using the given factor.
      Parameters:
      factor - the scaling factor
      res - return location for the scaled size
      Since:
      1.0