Class Quad

All Implemented Interfaces:
Proxy

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

A 4 vertex quadrilateral, as represented by four graphene_point_t.

The contents of a graphene_quad_t are private and should never be accessed directly.

Since:
1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Allocate a new Quad.
    Quad(Arena arena)
    Allocate a new Quad.
    Create a Quad proxy instance for the provided memory address.
    Quad(Point[] points)
    Allocate a new Quad with the fields set to the provided values.
    Quad(Point[] points, Arena arena)
    Allocate a new Quad with the fields set to the provided values.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Quad
    Allocates a new graphene_quad_t instance.
    void
    Computes the bounding rectangle of this Quad and places it into r.
    boolean
    Checks if the given graphene_quad_t contains the given graphene_point_t.
    void
    Frees the resources allocated by graphene_quad_alloc()
    The memory layout of the native struct.
    getPoint(int index)
    Retrieves the point of a graphene_quad_t at the given index.
    static @Nullable Type
    Get the GType of the Quad class.
    init(Point p1, Point p2, Point p3, Point p4)
    Initializes a graphene_quad_t with the given points.
    initFromPoints(@Nullable Point @Nullable [] points)
    Initializes a graphene_quad_t using an array of points.
    Initializes a graphene_quad_t using the four corners of the given graphene_rect_t.
    @Nullable Point @Nullable []
    Read the value of the field points.
    void
    writePoints(@Nullable Point @Nullable [] points, Arena _arena)
    Write a value in the field points.

    Methods inherited from class ProxyInstance

    equals, handle, hashCode

    Methods inherited from class Object

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

    • Quad

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

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

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

      public Quad(Point[] points, Arena arena)
      Allocate a new Quad with the fields set to the provided values.
      Parameters:
      points - value for the field points
      arena - to control the memory allocation scope
    • Quad

      public Quad(Point[] points)
      Allocate a new Quad with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      points - value for the field points
  • Method Details

    • getType

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

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

      public @Nullable Point @Nullable [] readPoints()
      Read the value of the field points.
      Returns:
      The value of the field points
    • writePoints

      public void writePoints(@Nullable Point @Nullable [] points, Arena _arena)
      Write a value in the field points.
      Parameters:
      points - The new value for the field points
    • alloc

      public static Quad alloc()

      Allocates a new graphene_quad_t instance.

      The contents of the returned instance are undefined.

      Returns:
      the newly created graphene_quad_t instance
      Since:
      1.0
    • bounds

      public void bounds(Rect r)
      Computes the bounding rectangle of this Quad and places it into r.
      Parameters:
      r - return location for a graphene_rect_t
      Since:
      1.0
    • contains

      public boolean contains(Point p)
      Checks if the given graphene_quad_t contains the given graphene_point_t.
      Parameters:
      p - a graphene_point_t
      Returns:
      true if the point is inside the graphene_quad_t
      Since:
      1.0
    • free

      public void free()
      Frees the resources allocated by graphene_quad_alloc()
      Since:
      1.0
    • getPoint

      public Point getPoint(int index)
      Retrieves the point of a graphene_quad_t at the given index.
      Parameters:
      index - the index of the point to retrieve
      Returns:
      a graphene_point_t
      Since:
      1.0
    • init

      public Quad init(Point p1, Point p2, Point p3, Point p4)
      Initializes a graphene_quad_t with the given points.
      Parameters:
      p1 - the first point of the quadrilateral
      p2 - the second point of the quadrilateral
      p3 - the third point of the quadrilateral
      p4 - the fourth point of the quadrilateral
      Returns:
      the initialized graphene_quad_t
      Since:
      1.0
    • initFromPoints

      public Quad initFromPoints(@Nullable Point @Nullable [] points)
      Initializes a graphene_quad_t using an array of points.
      Parameters:
      points - an array of 4 graphene_point_t
      Returns:
      the initialized graphene_quad_t
      Throws:
      IllegalArgumentException - when length of points is less than 4
      Since:
      1.2
    • initFromRect

      public Quad initFromRect(Rect r)
      Initializes a graphene_quad_t using the four corners of the given graphene_rect_t.
      Parameters:
      r - a graphene_rect_t
      Returns:
      the initialized graphene_quad_t
      Since:
      1.0