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) nothrow
GType _getGType() static nothrow
GType _gType() @property nothrow
Rect self() nothrowReturns `this`, for use in `with` statements.
graphene.point.Point origin() @property nothrowGet `origin` field. Returns: the coordinates of the origin of the rectangle
void origin(graphene.point.Point propval) @property nothrowSet `origin` field. Params: propval = the coordinates of the origin of the rectangle
graphene.size.Size size() @property nothrowGet `size` field. Returns: the size of the rectangle
void size(graphene.size.Size propval) @property nothrowSet `size` field. Params: propval = the size of the rectangle
bool containsPoint(graphene.point.Point p) nothrowChecks whether a #graphene_rect_t contains the given coordinates.
bool containsRect(graphene.rect.Rect b) nothrowChecks whether a #graphene_rect_t fully contains the given rectangle.
bool equal(graphene.rect.Rect b) nothrowChecks whether the two given rectangle are equal.
void expand(graphene.point.Point p, out graphene.rect.Rect res) nothrowExpands a #graphene_rect_t to contain the given #graphene_point_t.
float getArea() nothrowCompute the area of given normalized rectangle. Returns: the area of the normalized rectangle
void getBottomLeft(out graphene.point.Point p) nothrowRetrieves the coordinates of the bottom-left corner of the given rectangle.
void getBottomRight(out graphene.point.Point p) nothrowRetrieves the coordinates of the bottom-right corner of the given rectangle.
void getCenter(out graphene.point.Point p) nothrowRetrieves the coordinates of the center of the given rectangle.
float getHeight() nothrowRetrieves the normalized height of the given rectangle. Returns: the normalized height of the rectangle
void getTopLeft(out graphene.point.Point p) nothrowRetrieves the coordinates of the top-left corner of the given rectangle.
void getTopRight(out graphene.point.Point p) nothrowRetrieves the coordinates of the top-right corner of the given rectangle.
void getVertices(ref graphene.vec2.Vec2[] vertices) nothrowComputes the four vertices of a #graphene_rect_t.
float getWidth() nothrowRetrieves the normalized width of the given rectangle. Returns: the normalized width of the rectangle
float getX() nothrowRetrieves the normalized X coordinate of the origin of the given rectangle. Returns: the normalized X coordinate of the rectangle
float getY() nothrowRetrieves 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) nothrowInitializes the given #graphene_rect_t with the given values.
graphene.rect.Rect initFromRect(graphene.rect.Rect src) nothrowInitializes `r` using the given src rectangle.
graphene.rect.Rect inset(float dX, float dY) nothrowChanges 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) nothrowChanges 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) nothrowLinearly interpolates the origin and size of the two given rectangles.
bool intersection(graphene.rect.Rect b, out graphene.rect.Rect res) nothrowComputes the intersection of the two given rectangles.
graphene.rect.Rect normalize() nothrowNormalizes the passed rectangle.
void normalizeR(out graphene.rect.Rect res) nothrowNormalizes the passed rectangle.
graphene.rect.Rect offset(float dX, float dY) nothrowOffsets the origin by d_x and d_y.
void offsetR(float dX, float dY, out graphene.rect.Rect res) nothrowOffsets the origin of the given rectangle by d_x and d_y.
void round(out graphene.rect.Rect res) nothrowRounds 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) nothrowRounds 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() nothrowRounds 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) nothrowScales the size and origin of a rectangle horizontaly by s_h, and vertically by s_v. The result `r`es is normalized.
void union_(graphene.rect.Rect b, out graphene.rect.Rect res) nothrowComputes the union of the two given rectangles.
graphene.rect.Rect alloc() static nothrowAllocates a new #graphene_rect_t.
graphene.rect.Rect zero() static nothrowReturns 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)