graphene.rect

Module for [Rect] class

class Rect

Types 1

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.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.

Methods
void * _cPtr(Flag!"Dup" dup = No.Dup)
GType _gType() @property
Rect self()Returns `this`, for use in `with` statements.
graphene.point.Point origin() @propertyGet `origin` field. Returns: the coordinates of the origin of the rectangle
void origin(graphene.point.Point propval) @propertySet `origin` field. Params: propval = the coordinates of the origin of the rectangle
graphene.size.Size size() @propertyGet `size` field. Returns: the size of the rectangle
void size(graphene.size.Size propval) @propertySet `size` field. Params: propval = the size of the rectangle
bool containsPoint(graphene.point.Point p)Checks whether a #graphenerectt contains the given coordinates.
bool containsRect(graphene.rect.Rect b)Checks whether a #graphenerectt fully contains the given rectangle.
bool equal(graphene.rect.Rect b)Checks whether the two given rectangle are equal.
void expand(graphene.point.Point p, out graphene.rect.Rect res)Expands a #graphenerectt to contain the given #graphenepointt.
float getArea()Compute the area of given normalized rectangle. Returns: the area of the normalized rectangle
void getBottomLeft(out graphene.point.Point p)Retrieves the coordinates of the bottom-left corner of the given rectangle.
void getBottomRight(out graphene.point.Point p)Retrieves the coordinates of the bottom-right corner of the given rectangle.
void getCenter(out graphene.point.Point p)Retrieves the coordinates of the center of the given rectangle.
float getHeight()Retrieves the normalized height of the given rectangle. Returns: the normalized height of the rectangle
void getTopLeft(out graphene.point.Point p)Retrieves the coordinates of the top-left corner of the given rectangle.
void getTopRight(out graphene.point.Point p)Retrieves the coordinates of the top-right corner of the given rectangle.
void getVertices(ref graphene.vec2.Vec2[] vertices)Computes the four vertices of a #graphenerectt.
float getWidth()Retrieves the normalized width of the given rectangle. Returns: the normalized width of the rectangle
float getX()Retrieves the normalized X coordinate of the origin of the given rectangle. Returns: the normalized X coordinate of the rectangle
float getY()Retrieves the normalized Y coordinate of the origin of the given rectangle. Returns: the normalized Y coordinate of the rectangle
graphene.rect.Rect init_(float x, float y, float width, float height)Initializes the given #graphenerectt with the given values.
graphene.rect.Rect initFromRect(graphene.rect.Rect src)Initializes `r` using the given src rectangle.
graphene.rect.Rect inset(float dX, float dY)Changes the given rectangle to be smaller, or larger depending on the given inset parameters.
void insetR(float dX, float dY, out graphene.rect.Rect res)Changes the given rectangle to be smaller, or larger depending on the given inset parameters.
void interpolate(graphene.rect.Rect b, double factor, out graphene.rect.Rect res)Linearly interpolates the origin and size of the two given rectangles.
bool intersection(graphene.rect.Rect b, out graphene.rect.Rect res)Computes the intersection of the two given rectangles.
graphene.rect.Rect normalize()Normalizes the passed rectangle.
void normalizeR(out graphene.rect.Rect res)Normalizes the passed rectangle.
graphene.rect.Rect offset(float dX, float dY)Offsets the origin by dx and dy.
void offsetR(float dX, float dY, out graphene.rect.Rect res)Offsets the origin of the given rectangle by dx and dy.
void round(out graphene.rect.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...
void roundExtents(out graphene.rect.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.
graphene.rect.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. Returns: the pixel-aligned re...
void scale(float sH, float sV, out graphene.rect.Rect res)Scales the size and origin of a rectangle horizontaly by sh, and vertically by sv. The result `r`es is normalized.
void union_(graphene.rect.Rect b, out graphene.rect.Rect res)Computes the union of the two given rectangles.
graphene.rect.Rect alloc()Allocates a new #graphenerectt.
graphene.rect.Rect zero()Returns a degenerate rectangle with origin fixed at (0, 0) and a size of 0, 0. Returns: a fixed rectangle
Constructors
this(graphene.point.Point origin = graphene.point.Point.init, graphene.size.Size size = graphene.size.Size.init)Create a `rect.Rect` boxed type. Params: origin = the coordinates of the origin of the rectangle size = the size of the rectangle
this(void * ptr, Flag!"Take" take)