A rectangular region with rounded corners.
Application code should normalize rectangles using [methodGsk.RoundedRect.normalize]; this function will ensure that the bounds of the rectangle are normalized and ensure that the corner values are positive and the corners do not overlap.
All functions taking a GskRoundedRect as an argument will internally operate on a normalized copy; all functions returning a GskRoundedRect will always return a normalized one.
The algorithm used for normalizing corner sizes is described in the CSS specification.
function Contains_Point
(Self : access Gsk_Rounded_Rect;
Point : not null access Graphene.Point.Graphene_Point_T)
return Boolean
Checks if the given point is inside the rounded rectangle.
the point to check
true if the point is inside the rounded rectangle
function Contains_Rect
(Self : access Gsk_Rounded_Rect;
Rect : not null access Graphene.Rect.Graphene_Rect_T) return Boolean
Checks if the given rectangle is contained inside the rounded rectangle.
the rectangle to check
true if the Rect is fully contained inside the rounded rectangle
function From_Object_Free
(B : not null access Gsk_Rounded_Rect) return Gsk_Rounded_Rect
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.
type Gsk_Rounded_Rect is record
Bounds : Graphene.Rect.Graphene_Rect_T;
Corner : Graphene_Size_T_Array (1 .. 4);
end record;
A rectangular region with rounded corners.
Application code should normalize rectangles using [methodGsk.RoundedRect.normalize]; this function will ensure that the bounds of the rectangle are normalized and ensure that the corner values are positive and the corners do not overlap.
All functions taking a GskRoundedRect as an argument will internally operate on a normalized copy; all functions returning a GskRoundedRect will always return a normalized one.
The algorithm used for normalizing corner sizes is described in the CSS specification.
function Init
(Self : access Gsk_Rounded_Rect;
Bounds : not null access Graphene.Rect.Graphene_Rect_T;
Top_Left : not null access Graphene.Size.Graphene_Size_T;
Top_Right : not null access Graphene.Size.Graphene_Size_T;
Bottom_Right : not null access Graphene.Size.Graphene_Size_T;
Bottom_Left : not null access Graphene.Size.Graphene_Size_T)
return access Gsk_Rounded_Rect
Initializes a rounded rectangle with the given values. This function will implicitly normalize the rounded rectangle before returning.
a graphene_rect_t describing the bounds
the rounding radius of the top left corner
the rounding radius of the top right corner
the rounding radius of the bottom right corner
the rounding radius of the bottom left corner
the initialized rounded rectangle
function Init_Copy
(Self : access Gsk_Rounded_Rect;
Src : Gsk_Rounded_Rect) return access Gsk_Rounded_Rect
Initializes a rounded rectangle with a copy. This function will not normalize the rounded rectangle, so make sure the source is normalized.
another rounded rectangle
the initialized rounded rectangle
function Init_From_Rect
(Self : access Gsk_Rounded_Rect;
Bounds : not null access Graphene.Rect.Graphene_Rect_T;
Radius : Interfaces.C.C_float) return access Gsk_Rounded_Rect
Initializes a rounded rectangle to the given bounds and sets the radius of all four corners equally.
a graphene_rect_t
the border radius
the initialized rounded rectangle
function Intersects_Rect
(Self : access Gsk_Rounded_Rect;
Rect : not null access Graphene.Rect.Graphene_Rect_T) return Boolean
Checks if part a rectangle is contained inside the rounded rectangle.
the rectangle to check
true if the Rect intersects with the rounded rectangle
function Is_Rectilinear (Self : access Gsk_Rounded_Rect) return Boolean
Checks if all corners of a rounded rectangle are right angles and the rectangle covers all of its bounds. This information can be used to decide if [ctorGsk.ClipNode.new] or [ctorGsk.RoundedClipNode.new] should be called.
true if the rounded rectangle is rectilinear
function Normalize
(Self : access Gsk_Rounded_Rect) return access Gsk_Rounded_Rect
Normalizes a rounded rectangle. This function will ensure that the bounds of the rounded rectangle are normalized and ensure that the corner values are positive and the corners do not overlap.
the normalized rounded rectangle
function Offset
(Self : access Gsk_Rounded_Rect;
Dx : Interfaces.C.C_float;
Dy : Interfaces.C.C_float) return access Gsk_Rounded_Rect
Offsets the rounded rectangle's origin by Dx and Dy. The size and corners of the rounded rectangle are unchanged.
the horizontal offset
the vertical offset
the offset rounded rectangle
function Shrink
(Self : access Gsk_Rounded_Rect;
Top : Interfaces.C.C_float;
Right : Interfaces.C.C_float;
Bottom : Interfaces.C.C_float;
Left : Interfaces.C.C_float) return access Gsk_Rounded_Rect
Shrinks (or grows) a rounded rectangle by moving the 4 sides according to the offsets given. The corner radii will be changed in a way that tries to keep the center of the corner circle intact. This emulates CSS behavior. This function also works for growing rounded rectangles if you pass negative values for the Top, Right, Bottom or Left.
how far to move the top side downwards
how far to move the right side to the left
how far to move the bottom side upwards
how far to move the left side to the right
the resized rounded rectangle