Rect

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.

Constructors

this
this(graphene_rect_t* graphene_rect, bool ownedRef)

Sets our main struct and passes it to the parent class.

Destructor

~this
~this()
Undocumented in source.

Members

Aliases

unio
alias unio = union_
Undocumented in source.

Functions

containsPoint
bool containsPoint(Point p)

Checks whether a #graphene_rect_t contains the given coordinates.

containsRect
bool containsRect(Rect b)

Checks whether a #graphene_rect_t fully contains the given rectangle.

equal
bool equal(Rect b)

Checks whether the two given rectangle are equal.

expand
void expand(Point p, Rect res)

Expands a #graphene_rect_t to contain the given #graphene_point_t.

free
void free()

Frees the resources allocated by graphene_rect_alloc().

getArea
float getArea()

Compute the area of given normalized rectangle.

getBottomLeft
void getBottomLeft(Point p)

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

getBottomRight
void getBottomRight(Point p)

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

getCenter
void getCenter(Point p)

Retrieves the coordinates of the center of the given rectangle.

getHeight
float getHeight()

Retrieves the normalized height of the given rectangle.

getRectStruct
graphene_rect_t* getRectStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getTopLeft
void getTopLeft(Point p)

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

getTopRight
void getTopRight(Point p)

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

getVertices
void getVertices(Vec2[4] vertices)

Computes the four vertices of a #graphene_rect_t.

getWidth
float getWidth()

Retrieves the normalized width of the given rectangle.

getX
float getX()

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

getY
float getY()

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

init
Rect init(float x, float y, float width, float height)

Initializes the given #graphene_rect_t with the given values.

initFromRect
Rect initFromRect(Rect src)

Initializes @r using the given @src rectangle.

inset
Rect inset(float dX, float dY)

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

insetR
void insetR(float dX, float dY, Rect res)

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

interpolate
void interpolate(Rect b, double factor, Rect res)

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

intersection
bool intersection(Rect b, Rect res)

Computes the intersection of the two given rectangles.

normalize
Rect normalize()

Normalizes the passed rectangle.

normalizeR
void normalizeR(Rect res)

Normalizes the passed rectangle.

offset
Rect offset(float dX, float dY)

Offsets the origin by @d_x and @d_y.

offsetR
void offsetR(float dX, float dY, Rect res)

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

round
void round(Rect res)

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.

roundExtents
void roundExtents(Rect res)

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.

roundToPixel
Rect roundToPixel()

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.

scale
void scale(float sH, float sV, Rect res)

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

union_
void union_(Rect b, Rect res)

Computes the union of the two given rectangles.

Static functions

alloc
Rect alloc()

Allocates a new #graphene_rect_t.

getType
GType getType()
zero
Rect zero()

Returns a degenerate rectangle with origin fixed at (0, 0) and a size of 0, 0.

Variables

graphene_rect
graphene_rect_t* graphene_rect;

the main Gtk struct

ownedRef
bool ownedRef;
Undocumented in source.

Meta