A rectangular region with rounded corners.
Application code should normalize rectangles using
rounded-rect: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.
boundsthe bounds of the rectangle
cornerthe size of the 4 rounded corners
Checks if the given point is inside the rounded rectangle.
Passed: a <GskRoundedRect>.
a rounded rectangle
Passed: a <GraphenePoint>.
the point to check
Returned: a boolean.
true if the point is inside the rounded rectangle
Checks if the given rectangle is contained inside the rounded rectangle.
Passed: a <GskRoundedRect>.
a rounded rectangle
Passed: a <GrapheneRect>.
the rectangle to check
Returned: a boolean.
true if the rect is fully contained inside the rounded rectangle
Initializes a rounded rectangle with the given values.
This function will implicitly normalize the rounded rectangle before returning.
Passed: a <GskRoundedRect>.
the rounded rectangle to initialize
Passed: a <GrapheneRect>.
a <GrapheneRect> describing the bounds
Passed: a <GrapheneSize>.
the rounding radius of the top left corner
Passed: a <GrapheneSize>.
the rounding radius of the top right corner
Passed: a <GrapheneSize>.
the rounding radius of the bottom right corner
Passed: a <GrapheneSize>.
the rounding radius of the bottom left corner
Returned: a <GskRoundedRect>.
the initialized rounded rectangle
Initializes a rounded rectangle with a copy.
This function will not normalize the rounded rectangle, so make sure the source is normalized.
Passed: a <GskRoundedRect>.
the rounded rectangle to initialize
Passed: a <GskRoundedRect>.
another rounded rectangle
Returned: a <GskRoundedRect>.
the initialized rounded rectangle
Initializes a rounded rectangle to the given bounds and sets the radius of all four corners equally.
Passed: a <GskRoundedRect>.
the rounded rectangle to initialize
Passed: a <GrapheneRect>.
Passed: a real number.
the border radius
Returned: a <GskRoundedRect>.
the initialized rounded rectangle
Checks if part a rectangle is contained inside the rounded rectangle.
Passed: a <GskRoundedRect>.
a rounded rectangle
Passed: a <GrapheneRect>.
the rectangle to check
Returned: a boolean.
true if the rect intersects with the rounded rectangle
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 clip-node:new or rounded-clip-node:new should be called.
Passed: a <GskRoundedRect>.
the rounded rectangle to check
Returned: a boolean.
true if the rounded rectangle is rectilinear
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.
Passed: a <GskRoundedRect>.
a rounded rectangle
Returned: a <GskRoundedRect>.
the normalized rounded rectangle
Offsets the rounded rectangle’s origin by dx and dy.
The size and corners of the rounded rectangle are unchanged.
Passed: a <GskRoundedRect>.
a rounded rectangle
Passed: a real number.
the horizontal offset
Passed: a real number.
the vertical offset
Returned: a <GskRoundedRect>.
the offset rounded rectangle
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.
Passed: a <GskRoundedRect>.
the rounded rectangle to shrink or grow
Passed: a real number.
how far to move the top side downwards
Passed: a real number.
how far to move the right side to the left
Passed: a real number.
how far to move the bottom side upwards
Passed: a real number.
how far to move the left side to the right
Returned: a <GskRoundedRect>.
the resized rounded rectangle