Gjsify LogoGjsify Logo

The location and size of a rectangle.

The width and height of a #ClutterRect can be negative; Clutter considers a rectangle with an origin of [ 0.0, 0.0 ] and a size of [ 10.0, 10.0 ] to be equivalent to a rectangle with origin of [ 10.0, 10.0 ] and size of [ -10.0, -10.0 ].

Application code can normalize rectangles using clutter_rect_normalize(): this function will ensure that the width and height of a #ClutterRect are positive values. All functions taking a #ClutterRect as an argument will implicitly normalize it before computing eventual results. For this reason it is safer to access the contents of a #ClutterRect by using the provided API at all times, instead of directly accessing the structure members.

record

Hierarchy

  • Rect

Index

Constructors

Properties

origin: Clutter.Point

the origin of the rectangle

field

the size of the rectangle

field
name: string

Methods

  • clamp_to_pixel(): void
  • Rounds the origin of rect downwards to the nearest integer, and rounds the size of rect upwards to the nearest integer, so that rect is updated to the smallest rectangle capable of fully containing the original, fractional rectangle.

    Returns void

  • Checks whether a contains b.

    The first rectangle contains the second if the union of the two #ClutterRect is equal to the first rectangle.

    Parameters

    Returns boolean

  • free(): void
  • get_height(): number
  • get_width(): number
  • get_x(): number
  • get_y(): number
  • init(x: number, y: number, width: number, height: number): Clutter.Rect
  • Initializes a #ClutterRect with the given origin and size.

    Parameters

    • x: number

      X coordinate of the origin

    • y: number

      Y coordinate of the origin

    • width: number

      width of the rectangle

    • height: number

      height of the rectangle

    Returns Clutter.Rect

  • inset(d_x: number, d_y: number): void
  • Normalizes the rect and offsets its origin by the d_x and d_y values; the size is adjusted by (2 * d_x, 2 * d_y).

    If d_x and d_y are positive the size of the rectangle is decreased; if the values are negative, the size of the rectangle is increased.

    If the resulting rectangle has a negative width or height, the size is set to 0.

    Parameters

    • d_x: number

      an horizontal value; a positive d_x will create an inset rectangle, and a negative value will create a larger rectangle

    • d_y: number

      a vertical value; a positive d_x will create an inset rectangle, and a negative value will create a larger rectangle

    Returns void

  • Computes the intersection of a and b, and places it in res, if res is not %NULL.

    This function will normalize both a and b prior to computing their intersection.

    This function can be used to simply check if the intersection of a and b is not empty, by using %NULL for res.

    Parameters

    Returns [boolean, Clutter.Rect]

  • Normalizes a #ClutterRect.

    A #ClutterRect is defined by the area covered by its size; this means that a #ClutterRect with #ClutterRect.origin in [ 0, 0 ] and a #ClutterRect.size of [ 10, 10 ] is equivalent to a #ClutterRect with #ClutterRect.origin in [ 10, 10 ] and a #ClutterRect.size of [ -10, -10 ].

    This function is useful to ensure that a rectangle has positive width and height; it will modify the passed rect and normalize its size.

    Returns Clutter.Rect

  • offset(d_x: number, d_y: number): void
  • Offsets the origin of rect by the given values, after normalizing the rectangle.

    Parameters

    • d_x: number

      the horizontal offset value

    • d_y: number

      the vertical offset value

    Returns void

  • Computes the smallest possible rectangle capable of fully containing both a and b, and places it into res.

    This function will normalize both a and b prior to computing their union.

    Parameters

    Returns Clutter.Rect

  • Creates a new, empty #ClutterRect.

    You can use clutter_rect_init() to initialize the returned rectangle, for instance:

    |[ rect = clutter_rect_init (clutter_rect_alloc (), x, y, width, height);


    @constructor

    Returns Clutter.Rect

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