The location and size of a rectangle region.
The width and height of a Graphene.Rect.Graphene_Rect_T can be negative; for instance, a Graphene.Rect.Graphene_Rect_T with an origin of [ 0, 0 ] and a size of [ 10, 10 ] is equivalent to a Graphene.Rect.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.Graphene_Rect_T as an argument will internally operate on a normalized copy; all functions returning a Graphene.Rect.Graphene_Rect_T will always return a normalized rectangle.
function Contains_Point
(Self : not null access Graphene_Rect_T;
P : not null access Graphene.Point.Graphene_Point_T)
return Boolean
Checks whether a Graphene.Rect.Graphene_Rect_T contains the given coordinates. Since: gtk+ 1.0
a Graphene.Point.Graphene_Point_T
true if the rectangle contains the point
function Contains_Rect
(Self : not null access Graphene_Rect_T;
B : not null access Graphene_Rect_T) return Boolean
Checks whether a Graphene.Rect.Graphene_Rect_T fully contains the given rectangle. Since: gtk+ 1.0
a Graphene.Rect.Graphene_Rect_T
true if the rectangle A fully contains B
function Equal
(Self : not null access Graphene_Rect_T;
B : not null access Graphene_Rect_T) return Boolean
Checks whether the two given rectangle are equal. Since: gtk+ 1.0
a Graphene.Rect.Graphene_Rect_T
true if the rectangles are equal
procedure Expand
(Self : not null access Graphene_Rect_T;
P : not null access Graphene.Point.Graphene_Point_T;
Res : not null access Graphene_Rect_T)
Expands a Graphene.Rect.Graphene_Rect_T to contain the given Graphene.Point.Graphene_Point_T. Since: gtk+ 1.4
a Graphene.Point.Graphene_Point_T
return location for the expanded rectangle
procedure Free (Self : not null access Graphene_Rect_T)
Frees the resources allocated by graphene_rect_alloc. Since: gtk+ 1.0
function From_Object_Free
(B : not null access Graphene_Rect_T) return Graphene_Rect_T
Return the underlying object and free the pointer. This is meant to be used internally by GtkAda, and should not in general be called by user code.
function Get_Area
(Self : not null access Graphene_Rect_T) return Interfaces.C.C_float
Compute the area of given normalized rectangle. Since: gtk+ 1.10
the area of the normalized rectangle
procedure Get_Bottom_Left
(Self : not null access Graphene_Rect_T;
P : not null access Graphene.Point.Graphene_Point_T)
Retrieves the coordinates of the bottom-left corner of the given rectangle. Since: gtk+ 1.0
return location for a Graphene.Point.Graphene_Point_T
procedure Get_Bottom_Right
(Self : not null access Graphene_Rect_T;
P : not null access Graphene.Point.Graphene_Point_T)
Retrieves the coordinates of the bottom-right corner of the given rectangle. Since: gtk+ 1.0
return location for a Graphene.Point.Graphene_Point_T
procedure Get_Center
(Self : not null access Graphene_Rect_T;
P : not null access Graphene.Point.Graphene_Point_T)
Retrieves the coordinates of the center of the given rectangle. Since: gtk+ 1.0
return location for a Graphene.Point.Graphene_Point_T
function Get_Height
(Self : not null access Graphene_Rect_T) return Interfaces.C.C_float
Retrieves the normalized height of the given rectangle. Since: gtk+ 1.0
the normalized height of the rectangle
procedure Get_Top_Left
(Self : not null access Graphene_Rect_T;
P : not null access Graphene.Point.Graphene_Point_T)
Retrieves the coordinates of the top-left corner of the given rectangle. Since: gtk+ 1.0
return location for a Graphene.Point.Graphene_Point_T
procedure Get_Top_Right
(Self : not null access Graphene_Rect_T;
P : not null access Graphene.Point.Graphene_Point_T)
Retrieves the coordinates of the top-right corner of the given rectangle. Since: gtk+ 1.0
return location for a Graphene.Point.Graphene_Point_T
function Get_Type return Glib.GType
procedure Get_Vertices
(Self : not null access Graphene_Rect_T;
Vertices : out Graphene_Vec2_Array4)
Computes the four vertices of a Graphene.Rect.Graphene_Rect_T. Since: gtk+ 1.4
return location for an array of 4 Graphene.Vec2.Graphene_Vec2_T
function Get_Width
(Self : not null access Graphene_Rect_T) return Interfaces.C.C_float
Retrieves the normalized width of the given rectangle. Since: gtk+ 1.0
the normalized width of the rectangle
function Get_X
(Self : not null access Graphene_Rect_T) return Interfaces.C.C_float
Retrieves the normalized X coordinate of the origin of the given rectangle. Since: gtk+ 1.0
the normalized X coordinate of the rectangle
function Get_Y
(Self : not null access Graphene_Rect_T) return Interfaces.C.C_float
Retrieves the normalized Y coordinate of the origin of the given rectangle. Since: gtk+ 1.0
the normalized Y coordinate of the rectangle
type Graphene_Rect_T is record
Origin : Graphene.Point.Graphene_Point_T;
Size : Graphene.Size.Graphene_Size_T;
end record;
The location and size of a rectangle region.
The width and height of a Graphene.Rect.Graphene_Rect_T can be negative; for instance, a Graphene.Rect.Graphene_Rect_T with an origin of [ 0, 0 ] and a size of [ 10, 10 ] is equivalent to a Graphene.Rect.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.Graphene_Rect_T as an argument will internally operate on a normalized copy; all functions returning a Graphene.Rect.Graphene_Rect_T will always return a normalized rectangle.
type Graphene_Vec2_Array4 is array (1 .. 4) of Graphene.Vec2.Graphene_Vec2_T;
function Init
(Self : not null access Graphene_Rect_T;
X : Interfaces.C.C_float;
Y : Interfaces.C.C_float;
Width : Interfaces.C.C_float;
Height : Interfaces.C.C_float) return access Graphene_Rect_T
Initializes the given Graphene.Rect.Graphene_Rect_T with the given values. This function will implicitly normalize the Graphene.Rect.Graphene_Rect_T before returning. Since: gtk+ 1.0
the X coordinate of the Graphene_Rect_T.origin
the Y coordinate of the Graphene_Rect_T.origin
the width of the Graphene_Rect_T.size
the height of the Graphene_Rect_T.size
the initialized rectangle
function Init_From_Rect
(Self : not null access Graphene_Rect_T;
Src : not null access Graphene_Rect_T) return access Graphene_Rect_T
Initializes R using the given Src rectangle. This function will implicitly normalize the Graphene.Rect.Graphene_Rect_T before returning. Since: gtk+ 1.0
a Graphene.Rect.Graphene_Rect_T
the initialized rectangle
function Inset
(Self : not null access Graphene_Rect_T;
D_X : Interfaces.C.C_float;
D_Y : Interfaces.C.C_float) return access Graphene_Rect_T
Changes the given rectangle to be smaller, or larger depending on the given inset parameters. To create an inset rectangle, use positive D_X or D_Y values; to create a larger, encompassing rectangle, use negative D_X or D_Y values. The origin of the rectangle is offset by D_X and D_Y, while the size is adjusted by (2 * D_X, 2 * D_Y). If D_X and D_Y are positive values, the size of the rectangle is decreased; if D_X and D_Y are negative values, the size of the rectangle is increased. If the size of the resulting inset rectangle has a negative width or height then the size will be set to zero. Since: gtk+ 1.0
the horizontal inset
the vertical inset
the inset rectangle
procedure Inset_R
(Self : not null access Graphene_Rect_T;
D_X : Interfaces.C.C_float;
D_Y : Interfaces.C.C_float;
Res : not null access Graphene_Rect_T)
Changes the given rectangle to be smaller, or larger depending on the given inset parameters. To create an inset rectangle, use positive D_X or D_Y values; to create a larger, encompassing rectangle, use negative D_X or D_Y values. The origin of the rectangle is offset by D_X and D_Y, while the size is adjusted by (2 * D_X, 2 * D_Y). If D_X and D_Y are positive values, the size of the rectangle is decreased; if D_X and D_Y are negative values, the size of the rectangle is increased. If the size of the resulting inset rectangle has a negative width or height then the size will be set to zero. Since: gtk+ 1.4
the horizontal inset
the vertical inset
return location for the inset rectangle
procedure Interpolate
(Self : not null access Graphene_Rect_T;
B : not null access Graphene_Rect_T;
Factor : Gdouble;
Res : not null access Graphene_Rect_T)
Linearly interpolates the origin and size of the two given rectangles. Since: gtk+ 1.0
a Graphene.Rect.Graphene_Rect_T
the linear interpolation factor
return location for the interpolated rectangle
function Intersection
(Self : not null access Graphene_Rect_T;
B : not null access Graphene_Rect_T;
Res : access Graphene_Rect_T := null) return Boolean
Computes the intersection of the two given rectangles.
The intersection in the image above is the blue outline. If the two rectangles do not intersect, Res will contain a degenerate rectangle with origin in (0, 0) and a size of 0. Since: gtk+ 1.0
a Graphene.Rect.Graphene_Rect_T
return location for a Graphene.Rect.Graphene_Rect_T
true if the two rectangles intersect
function Normalize
(Self : not null access Graphene_Rect_T) return access Graphene_Rect_T
Normalizes the passed rectangle. This function ensures that the size of the rectangle is made of positive values, and that the origin is the top-left corner of the rectangle. Since: gtk+ 1.0
the normalized rectangle
procedure Normalize_R
(Self : not null access Graphene_Rect_T;
Res : not null access Graphene_Rect_T)
Normalizes the passed rectangle. This function ensures that the size of the rectangle is made of positive values, and that the origin is in the top-left corner of the rectangle. Since: gtk+ 1.4
the return location for the normalized rectangle
function Offset
(Self : not null access Graphene_Rect_T;
D_X : Interfaces.C.C_float;
D_Y : Interfaces.C.C_float) return access Graphene_Rect_T
Offsets the origin by D_X and D_Y. The size of the rectangle is unchanged. Since: gtk+ 1.0
the horizontal offset
the vertical offset
the offset rectangle
procedure Offset_R
(Self : not null access Graphene_Rect_T;
D_X : Interfaces.C.C_float;
D_Y : Interfaces.C.C_float;
Res : not null access Graphene_Rect_T)
Offsets the origin of the given rectangle by D_X and D_Y. The size of the rectangle is left unchanged. Since: gtk+ 1.4
the horizontal offset
the vertical offset
return location for the offset rectangle
procedure Round_Extents
(Self : not null access Graphene_Rect_T;
Res : not null access Graphene_Rect_T)
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. This function is the equivalent of calling floor on the coordinates of the origin, and recomputing the size calling ceil on the bottom-right coordinates. If you want to be sure that the rounded rectangle completely covers the area that was covered by the original rectangle â i.e. you want to cover the area including all its corners â this function will make sure that the size is recomputed taking into account the ceiling of the coordinates of the bottom-right corner. If the difference between the original coordinates and the coordinates of the rounded rectangle is greater than the difference between the original size and and the rounded size, then the move of the origin would not be compensated by a move in the anti-origin, leaving the corners of the original rectangle outside the rounded one. Since: gtk+ 1.10
return location for the rectangle with rounded extents
procedure Scale
(Self : not null access Graphene_Rect_T;
S_H : Interfaces.C.C_float;
S_V : Interfaces.C.C_float;
Res : not null access Graphene_Rect_T)
Scales the size and origin of a rectangle horizontaly by S_H, and vertically by S_V. The result Res is normalized. Since: gtk+ 1.10
horizontal scale factor
vertical scale factor
return location for the scaled rectangle
procedure Union
(Self : not null access Graphene_Rect_T;
B : not null access Graphene_Rect_T;
Res : not null access Graphene_Rect_T)
Computes the union of the two given rectangles.
The union in the image above is the blue outline. Since: gtk+ 1.0
a Graphene.Rect.Graphene_Rect_T
return location for a Graphene.Rect.Graphene_Rect_T
function Zero return access constant Graphene_Rect_T
Returns a degenerate rectangle with origin fixed at (0, 0) and a size of 0, 0. Since: gtk+ 1.4
a fixed rectangle