Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GskRoundedRect

[20:7] extends: object

A rectangular region with rounded corners. Application code should normalize rectangles using [method@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.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • GskRoundedRect (Handle = null)

    Creates a new RoundedRect by wrapping a native handle or another wrapper.

    • @p Handle is the native handle or another wrapper whose handle to adopt.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • contains_point (object point)

    Checks if the given point is inside the rounded rectangle.

    • @p point is the point to check.
    • @r true if the point is inside the rounded rectangle.
  • contains_rect (object rect)

    Checks if the given rectangle is contained inside the rounded rectangle.

    • @p rect is the rectangle to check.
    • @r true if the @rect is fully contained inside the rounded rectangle.
  • init (object bounds, object top_left, object top_right, object bottom_right, object bottom_left)

    Initializes a rounded rectangle with the given values. This function will implicitly normalize the rounded rectangle before returning.

    • @p bounds is a graphene_rect_t describing the bounds.
    • @p top_left is the rounding radius of the top left corner.
    • @p top_right is the rounding radius of the top right corner.
    • @p bottom_right is the rounding radius of the bottom right corner.
    • @p bottom_left is the rounding radius of the bottom left corner.
    • @r the initialized rounded rectangle.
  • init_copy (object src)

    Initializes a rounded rectangle with a copy. This function will not normalize the rounded rectangle, so make sure the source is normalized.

    • @p src is another rounded rectangle.
    • @r the initialized rounded rectangle.
  • init_from_rect (object bounds, double radius)

    Initializes a rounded rectangle to the given bounds and sets the radius of all four corners equally.

    • @p bounds is a graphene_rect_t.
    • @p radius is the border radius.
    • @r the initialized rounded rectangle.
  • intersects_rect (object rect)

    Checks if part a rectangle is contained inside the rounded rectangle.

    • @p rect is the rectangle to check.
    • @r true if the @rect intersects with the rounded rectangle.
  • is_rectilinear ()

    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 [ctor@Gsk.ClipNode.new] or [ctor@Gsk.RoundedClipNode.new] should be called.

    • @r true if the rounded rectangle is rectilinear.
  • normalize ()

    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.

    • @r the normalized rounded rectangle.
  • offset (double dx, double dy)

    Offsets the rounded rectangle's origin by @dx and @dy. The size and corners of the rounded rectangle are unchanged.

    • @p dx is the horizontal offset.
    • @p dy is the vertical offset.
    • @r the offset rounded rectangle.
  • shrink (double top, double right, double bottom, double left)

    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.

    • @p top is how far to move the top side downwards.
    • @p right is how far to move the right side to the left.
    • @p bottom is how far to move the bottom side upwards.
    • @p left is how far to move the left side to the right.
    • @r the resized rounded rectangle.