Description:
[ CCode ( copy_function = "g_boxed_copy" , free_function = "g_boxed_free" , type_id = "clutter_rect_get_type ()" ) ]
[ Version ( since = "1.12" ) ]
public struct Rect
The location and size of a rectangle.
The width and height of a Rect 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 normalize: this
function will ensure that the width and height of a Rect are positive values. All functions taking a
Rect as an argument will implicitly normalize it before computing eventual results. For this reason it is safer to
access the contents of a Rect by using the provided API at all times, instead of directly accessing the structure
members.
Content:
Static methods:
Methods:
- public void clamp_to_pixel ()
Rounds the origin of this downwards to
the nearest integer, and rounds the size of this upwards to the nearest integer, so that
this is updated to the smallest rectangle capable of fully containing the original, fractional
rectangle.
- public bool contains_point (Point point)
Checks whether point is contained by
this, after normalizing the rectangle.
- public bool contains_rect (Rect b)
Checks whether this contains b
.
- public Rect? copy ()
Copies this into a new
Rect instance.
- public bool equals (Rect b)
Checks whether this and b
are equals.
- public void free ()
Frees the resources allocated by this.
- public Point get_center ()
Retrieves the center of this, after
normalizing the rectangle, and updates center with the correct coordinates.
- public float get_height ()
Retrieves the height of this.
- public float get_width ()
Retrieves the width of this.
- public float get_x ()
Retrieves the X coordinate of the origin of
this.
- public float get_y ()
Retrieves the Y coordinate of the origin of
this.
- public unowned Rect? init (float x, float y, float width, float height)
Initializes a Rect with the given origin and
size.
- public void inset (float d_x, float d_y)
Normalizes the this and offsets its
origin by the d_x and d_y values; the size is adjusted by (2 * d_x, 2 * d_y).
- public bool intersection (Rect b, out Rect res)
Computes the intersection of this and
b, and places it in res, if res is not null.
- public Rect? normalize ()
Normalizes a Rect.
- public void offset (float d_x, float d_y)
Offsets the origin of this by the given
values, after normalizing the rectangle.
- public Rect union (Rect b)
Computes the smallest possible rectangle capable of fully containing both
this and b, and places it into res.
Fields: