Gjsify LogoGjsify Logo

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.

record

Hierarchy

  • RoundedRect

Index

Constructors

Properties

bounds: Graphene.Rect

the bounds of the rectangle

field
corner: Graphene.Size[]

the size of the 4 rounded corners

field
name: string

Methods

  • Initializes the given GskRoundedRect with the given values.

    This function will implicitly normalize the GskRoundedRect before returning.

    Parameters

    • bounds: Graphene.Rect

      a graphene_rect_t describing the bounds

    • top_left: Graphene.Size

      the rounding radius of the top left corner

    • top_right: Graphene.Size

      the rounding radius of the top right corner

    • bottom_right: Graphene.Size

      the rounding radius of the bottom right corner

    • bottom_left: Graphene.Size

      the rounding radius of the bottom left corner

    Returns RoundedRect

  • is_rectilinear(): boolean
  • 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 [ctorGsk.ClipNode.new] or [ctorGsk.RoundedClipNode.new] should be called.

    Returns boolean

  • 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.

    Returns RoundedRect

  • Offsets the bound's origin by dx and dy.

    The size and corners of the rectangle are unchanged.

    Parameters

    • dx: number

      the horizontal offset

    • dy: number

      the vertical offset

    Returns RoundedRect

  • shrink(top: number, right: number, bottom: number, left: number): 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.

    Parameters

    • top: number

      How far to move the top side downwards

    • right: number

      How far to move the right side to the left

    • bottom: number

      How far to move the bottom side upwards

    • left: number

      How far to move the left side to the right

    Returns RoundedRect

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method