Package org.gnome.graphene
Class Size
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.graphene.Size
-
Constructor Summary
ConstructorsConstructorDescriptionSize()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 Sizealloc()Allocates a newgraphene_size_t.booleanChecks whether the two givegraphene_size_tare equal.voidfree()Frees the resources allocated by graphene_size_alloc().static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the Size classinit(float width, float height) Initializes agraphene_size_tusing the givenwidthandheight.initFromSize(Size src) Initializes agraphene_size_tusing the width and height of the givensrc.voidinterpolate(Size b, double factor, Size res) Linearly interpolates the two givengraphene_size_tusing the given interpolationfactor.floatRead the value of the fieldheight.floatRead the value of the fieldwidth.voidScales the components of agraphene_size_tusing the givenfactor.voidwriteHeight(float height) Write a value in the fieldheight.voidwriteWidth(float width) Write a value in the fieldwidth.static Sizezero()A constant pointer to a zerographene_size_t, useful for equality checks and interpolations.Methods inherited from class org.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 fieldwidthheight- value for the fieldheightarena- 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 fieldwidthheight- 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 - Since:
- 1.0
-
zero
A constant pointer to a zerographene_size_t, useful for equality checks and interpolations.- Returns:
- a constant size
- Since:
- 1.0
-
equal
Checks whether the two givegraphene_size_tare equal.- Parameters:
b- agraphene_size_t- Returns:
trueif the sizes are equal- Since:
- 1.0
-
free
public void free()Frees the resources allocated by graphene_size_alloc().- Since:
- 1.0
-
init
Initializes agraphene_size_tusing the givenwidthandheight.- Parameters:
width- the widthheight- the height- Returns:
- the initialized
graphene_size_t - Since:
- 1.0
-
initFromSize
-
interpolate
-
scale
Scales the components of agraphene_size_tusing the givenfactor.- Parameters:
factor- the scaling factorres- return location for the scaled size- Since:
- 1.0
-