Rect

class Rect(pointer: <Error class: unknown class><<Error class: unknown class>>)

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: Point

  • field size: Size

Since

1.0

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

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(): Float

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

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

Retrieves the normalized width of the given rectangle.

Link copied to clipboard
fun getX(): Float

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

Link copied to clipboard
fun getY(): Float

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

Link copied to clipboard
fun init(x: Float, y: Float, width: Float, height: Float): 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: Float, dY: Float): Rect

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

Link copied to clipboard
fun insetR(dX: Float, dY: Float, 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: Double, 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: Float, dY: Float): Rect

Offsets the origin by @d_x and @d_y.

Link copied to clipboard
fun offsetR(dX: Float, dY: Float, 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: Float, sV: Float, 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.