Rect

class Rect(val grapheneRectPointer: <Error class: unknown class><<Error class: unknown class>>, cleaner: <Error class: unknown class>? = null)

The location and size of a rectangle region.

The width and height of a #graphene_rect_t can be negative; for instance, a #graphene_rect_t with an origin of 0, 0 and a size of 10, 10 is equivalent to a #graphene_rect_t with an origin of 10, 10 and a size of -10, -10 .

Application code can normalize rectangles using graphene_rect_normalize(); this function will ensure that the width and height of a rectangle are positive values. All functions taking a #graphene_rect_t as an argument will internally operate on a normalized copy; all functions returning a #graphene_rect_t will always return a normalized rectangle.

Skipped during bindings generation

  • parameter vertices: vertices: Out parameter is not supported

  • field origin: Field with not-pointer record/union graphene_point_t is not supported

  • field size: Field with not-pointer record/union graphene_size_t is not supported

Since

1.0

Constructors

Link copied to clipboard
constructor()

Allocate a new Rect.

constructor(scope: <Error class: unknown class>)

Allocate a new Rect using the provided AutofreeScope.

constructor(grapheneRectPointer: <Error class: unknown class><<Error class: unknown class>>, cleaner: <Error class: unknown class>? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val grapheneRectPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard

Checks whether a #graphene_rect_t contains the given coordinates.

Link copied to clipboard

Checks whether a #graphene_rect_t fully contains the given rectangle.

Link copied to clipboard
fun equal(b: Rect): Boolean

Checks whether the two given rectangle are equal.

Link copied to clipboard
fun expand(p: Point, res: Rect)

Expands a #graphene_rect_t to contain the given #graphene_point_t.

Link copied to clipboard
fun free()

Frees the resources allocated by graphene_rect_alloc().

Link copied to clipboard
fun getArea(): <Error class: unknown class>

Compute the area of given normalized rectangle.

Link copied to clipboard

Retrieves the coordinates of the bottom-left corner of the given rectangle.

Link copied to clipboard

Retrieves the coordinates of the bottom-right corner of the given rectangle.

Link copied to clipboard

Retrieves the coordinates of the center of the given rectangle.

Link copied to clipboard
fun getHeight(): <Error class: unknown class>

Retrieves the normalized height of the given rectangle.

Link copied to clipboard

Retrieves the coordinates of the top-left corner of the given rectangle.

Link copied to clipboard

Retrieves the coordinates of the top-right corner of the given rectangle.

Link copied to clipboard
fun getWidth(): <Error class: unknown class>

Retrieves the normalized width of the given rectangle.

Link copied to clipboard
fun getX(): <Error class: unknown class>

Retrieves the normalized X coordinate of the origin of the given rectangle.

Link copied to clipboard
fun getY(): <Error class: unknown class>

Retrieves the normalized Y coordinate of the origin of the given rectangle.

Link copied to clipboard
fun init(x: <Error class: unknown class>, y: <Error class: unknown class>, width: <Error class: unknown class>, height: <Error class: unknown class>): Rect

Initializes the given #graphene_rect_t with the given values.

Link copied to clipboard

Initializes @r using the given @src rectangle.

Link copied to clipboard
fun inset(dX: <Error class: unknown class>, dY: <Error class: unknown class>): Rect

Changes the given rectangle to be smaller, or larger depending on the given inset parameters.

Link copied to clipboard
fun insetR(dX: <Error class: unknown class>, dY: <Error class: unknown class>, res: Rect)

Changes the given rectangle to be smaller, or larger depending on the given inset parameters.

Link copied to clipboard
fun interpolate(b: Rect, factor: <Error class: unknown class>, res: Rect)

Linearly interpolates the origin and size of the two given rectangles.

Link copied to clipboard
fun intersection(b: Rect, res: Rect?): Boolean

Computes the intersection of the two given rectangles.

Link copied to clipboard

Normalizes the passed rectangle.

Link copied to clipboard
fun normalizeR(res: Rect)

Normalizes the passed rectangle.

Link copied to clipboard
fun offset(dX: <Error class: unknown class>, dY: <Error class: unknown class>): Rect

Offsets the origin by @d_x and @d_y.

Link copied to clipboard
fun offsetR(dX: <Error class: unknown class>, dY: <Error class: unknown class>, res: Rect)

Offsets the origin of the given rectangle by @d_x and @d_y.

Link copied to clipboard
fun round(res: Rect)

Rounds the origin and size of the given rectangle to their nearest integer values; the rounding is guaranteed to be large enough to have an area bigger or equal to the original rectangle, but might not fully contain its extents. Use graphene_rect_round_extents() in case you need to round to a rectangle that covers fully the original one.

Link copied to clipboard
fun roundExtents(res: Rect)

Rounds the origin of the given rectangle to its nearest integer value and and recompute the size so that the rectangle is large enough to contain all the conrners of the original rectangle.

Link copied to clipboard

Rounds the origin and the size of the given rectangle to their nearest integer values; the rounding is guaranteed to be large enough to contain the original rectangle.

Link copied to clipboard
fun scale(sH: <Error class: unknown class>, sV: <Error class: unknown class>, res: Rect)

Scales the size and origin of a rectangle horizontaly by @s_h, and vertically by @s_v. The result @res is normalized.

Link copied to clipboard
fun union(b: Rect, res: Rect)

Computes the union of the two given rectangles.