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

  • Checks if the given point is inside the rounded rectangle.

    Parameters

    Returns boolean

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

    Parameters

    Returns boolean

  • 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

    • topLeft: Graphene.Size

      the rounding radius of the top left corner

    • topRight: Graphene.Size

      the rounding radius of the top right corner

    • bottomRight: Graphene.Size

      the rounding radius of the bottom right corner

    • bottomLeft: Graphene.Size

      the rounding radius of the bottom left corner

    Returns RoundedRect

  • Initializes self using the given src rectangle.

    This function will not normalize the GskRoundedRect, so make sure the source is normalized.

    Parameters

    Returns RoundedRect

  • Initializes self to the given bounds and sets the radius of all four corners to radius.

    Parameters

    • bounds: Graphene.Rect

      a graphene_rect_t

    • radius: number

      the border radius

    Returns RoundedRect

  • Checks if part of the given rect is contained inside the rounded rectangle.

    Parameters

    Returns boolean

  • isRectilinear(): 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