Package org.gnome.graphene
Class Size
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.gnome.graphene.Size
-
Constructor Summary
ConstructorDescriptionSize()
Allocate a new Size.Size
(float width, float height) Allocate a new Size with the fields set to the provided values.Allocate a new Size with the fields set to the provided values.Allocate a new Size.Size
(MemorySegment address) Create a Size proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionstatic Size
alloc()
Allocates a newgraphene_size_t
.boolean
Checks whether the two givegraphene_size_t
are equal.void
free()
Frees the resources allocated by graphene_size_alloc().static MemoryLayout
The memory layout of the native struct.static Type
getType()
Get the GType of the Size classinit
(float width, float height) Initializes agraphene_size_t
using the givenwidth
andheight
.initFromSize
(Size src) Initializes agraphene_size_t
using the width and height of the givensrc
.void
interpolate
(Size b, double factor, Size res) Linearly interpolates the two givengraphene_size_t
using the given interpolationfactor
.float
Read the value of the fieldheight
.float
Read the value of the fieldwidth
.void
Scales the components of agraphene_size_t
using the givenfactor
.void
writeHeight
(float height) Write a value in the fieldheight
.void
writeWidth
(float width) Write a value in the fieldwidth
.static Size
zero()
A constant pointer to a zerographene_size_t
, useful for equality checks and interpolations.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Size
Create a Size proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
Size
Allocate a new Size.- Parameters:
arena
- to control the memory allocation scope
-
Size
public Size()Allocate a new Size. The memory is allocated withArena.ofAuto()
. -
Size
Allocate a new Size with the fields set to the provided values.- Parameters:
width
- value for the fieldwidth
height
- value for the fieldheight
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 withArena.ofAuto()
.- Parameters:
width
- value for the fieldwidth
height
- value for the fieldheight
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readWidth
public float readWidth()Read the value of the fieldwidth
.- Returns:
- The value of the field
width
-
writeWidth
public void writeWidth(float width) Write a value in the fieldwidth
.- Parameters:
width
- The new value for the fieldwidth
-
readHeight
public float readHeight()Read the value of the fieldheight
.- Returns:
- The value of the field
height
-
writeHeight
public void writeHeight(float height) Write a value in the fieldheight
.- Parameters:
height
- The new value for the fieldheight
-
alloc
Allocates a newgraphene_size_t
.The contents of the returned value are undefined.
- Returns:
- the newly allocated
graphene_size_t
-
zero
A constant pointer to a zerographene_size_t
, useful for equality checks and interpolations.- Returns:
- a constant size
-
equal
Checks whether the two givegraphene_size_t
are equal.- Parameters:
b
- agraphene_size_t
- Returns:
true
if the sizes are equal
-
free
public void free()Frees the resources allocated by graphene_size_alloc(). -
init
Initializes agraphene_size_t
using the givenwidth
andheight
.- Parameters:
width
- the widthheight
- the height- Returns:
- the initialized
graphene_size_t
-
initFromSize
-
interpolate
-
scale
Scales the components of agraphene_size_t
using the givenfactor
.- Parameters:
factor
- the scaling factorres
- return location for the scaled size
-