:right-sidebar: True RoundedRect =================================================================== .. currentmodule:: gi.repository.Gsk .. class:: RoundedRect(*args, **kwargs) :no-contents-entry: A rectangular region with rounded corners. Application code should normalize rectangles using :obj:`~gi.repository.Gsk.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 `__\. Methods ------- .. rst-class:: interim-class .. class:: RoundedRect :no-index: .. method:: contains_point(point: ~gi.repository.Graphene.Point) -> bool Checks if the given ``point`` is inside the rounded rectangle. :param point: the point to check .. method:: contains_rect(rect: ~gi.repository.Graphene.Rect) -> bool Checks if the given ``rect`` is contained inside the rounded rectangle. :param rect: the rectangle to check .. method:: init(bounds: ~gi.repository.Graphene.Rect, top_left: ~gi.repository.Graphene.Size, top_right: ~gi.repository.Graphene.Size, bottom_right: ~gi.repository.Graphene.Size, bottom_left: ~gi.repository.Graphene.Size) -> ~gi.repository.Gsk.RoundedRect Initializes the given ``GskRoundedRect`` with the given values. This function will implicitly normalize the ``GskRoundedRect`` before returning. :param bounds: a ``graphene_rect_t`` describing the bounds :param top_left: the rounding radius of the top left corner :param top_right: the rounding radius of the top right corner :param bottom_right: the rounding radius of the bottom right corner :param bottom_left: the rounding radius of the bottom left corner .. method:: init_from_rect(bounds: ~gi.repository.Graphene.Rect, radius: float) -> ~gi.repository.Gsk.RoundedRect Initializes ``self`` to the given ``bounds`` and sets the radius of all four corners to ``radius``\. :param bounds: a ``graphene_rect_t`` :param radius: the border radius .. method:: intersects_rect(rect: ~gi.repository.Graphene.Rect) -> bool Checks if part of the given ``rect`` is contained inside the rounded rectangle. :param rect: the rectangle to check .. method:: is_rectilinear() -> bool Checks if all corners of ``self`` are right angles and the rectangle covers all of its bounds. This information can be used to decide if :obj:`~gi.repository.Gsk.ClipNode.new` or :obj:`~gi.repository.Gsk.RoundedClipNode.new` should be called. .. method:: normalize() -> ~gi.repository.Gsk.RoundedRect Normalizes the passed rectangle. 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. .. method:: offset(dx: float, dy: float) -> ~gi.repository.Gsk.RoundedRect Offsets the bound's origin by ``dx`` and ``dy``\. The size and corners of the rectangle are unchanged. :param dx: the horizontal offset :param dy: the vertical offset .. method:: shrink(top: float, right: float, bottom: float, left: float) -> ~gi.repository.Gsk.RoundedRect Shrinks (or grows) the given 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 rectangles if you pass negative values for the ``top``\, ``right``\, ``bottom`` or ``left``\. :param top: How far to move the top side downwards :param right: How far to move the right side to the left :param bottom: How far to move the bottom side upwards :param left: How far to move the left side to the right Fields ------ .. rst-class:: interim-class .. class:: RoundedRect :no-index: .. attribute:: bounds The bounds of the rectangle .. attribute:: corner The size of the 4 rounded corners