cluttermm: Clutter::Rect Class Reference
Public Member Functions | |
Rect (ClutterRect* gobject, bool make_a_copy=true) | |
Rect (const Rect& other) | |
Rect& | operator= (const Rect& other) |
~Rect () | |
void | swap (Rect& other) |
ClutterRect* | gobj () |
Provides access to the underlying C instance. More... | |
const ClutterRect* | gobj () const |
Provides access to the underlying C instance. More... | |
ClutterRect* | gobj_copy () const |
Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. More... | |
Rect (float x=0, float y=0, float width=0, float height=0) | |
Create a new Rect object, optionally specifying its dimensions. More... | |
Rect | normalise () |
Normalizes a Clutter::Rect. More... | |
Point | get_centre () const |
Retrieves the center of the rect and returns a rect with the correct coordinates. More... | |
bool | contains_point (const Point& point) const |
Checks whether point is contained by rect, after normalizing the rectangle. More... | |
bool | contains_rect (const Rect& b) const |
Checks whether a contains b. More... | |
Rect | rect_union (const Rect& b) const |
Computes the smallest possible rectangle capable of fully containing both this rect and b, and returns it. More... | |
bool | intersection (const Rect& b, Rect& res) const |
Computes the intersection of a and b, and places it in res, if res is not 0 . More... | |
void | offset (float d_x, float d_y) |
Offsets the origin of rect by the given values, after normalizing the rectangle. More... | |
void | inset (float d_x, float d_y) |
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). More... | |
void | clamp_to_pixel () |
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. More... | |
float | get_x () const |
Retrieves the X coordinate of the origin of rect. More... | |
float | get_y () const |
Retrieves the Y coordinate of the origin of rect. More... | |
float | get_width () const |
Retrieves the width of rect. More... | |
float | get_height () const |
Retrieves the height of rect. More... | |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
Protected Attributes | |
ClutterRect* | gobject_ |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator== (const Rect& lhs, const Rect& rhs) |
bool | operator!= (const Rect& lhs, const Rect& rhs) |
void | swap (Rect& lhs, Rect& rhs) |
Clutter::Rect | wrap (ClutterRect* object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
Constructor & Destructor Documentation
|
explicit |
Clutter::Rect::Rect | ( | const Rect& | other) |
Clutter::Rect::~Rect | ( | ) |
|
explicit |
Create a new Rect object, optionally specifying its dimensions.
Member Function Documentation
void Clutter::Rect::clamp_to_pixel | ( | ) |
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.
bool Clutter::Rect::contains_point | ( | const Point& | point) | const |
Checks whether point is contained by rect, after normalizing the rectangle.
- Parameters
-
point The point to check.
- Returns
true
if the point is contained by rect.
bool Clutter::Rect::contains_rect | ( | const Rect& | b) | const |
Checks whether a contains b.
The first rectangle contains the second if the union of the two Clutter::Rect is equal to the first rectangle.
- Parameters
-
b A Clutter::Rect.
- Returns
true
if the first rectangle contains the second.
Point Clutter::Rect::get_centre | ( | ) | const |
Retrieves the center of the rect and returns a rect with the correct coordinates.
float Clutter::Rect::get_height | ( | ) | const |
|
static |
Get the GType for this class, for use with the underlying GObject type system.
float Clutter::Rect::get_width | ( | ) | const |
float Clutter::Rect::get_x | ( | ) | const |
Retrieves the X coordinate of the origin of rect.
- Returns
- The X coordinate of the origin of the rectangle.
float Clutter::Rect::get_y | ( | ) | const |
Retrieves the Y coordinate of the origin of rect.
- Returns
- The Y coordinate of the origin of the rectangle.
|
inline |
Provides access to the underlying C instance.
|
inline |
Provides access to the underlying C instance.
ClutterRect* Clutter::Rect::gobj_copy | ( | ) | const |
Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
void Clutter::Rect::inset | ( | float | d_x, |
float | d_y | ||
) |
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 An horizontal value; a positive d_x will create an inset rectangle, and a negative value will create a larger rectangle. d_y A vertical value; a positive d_x will create an inset rectangle, and a negative value will create a larger rectangle.
Computes the intersection of a and b, and places it in res, if res is not 0
.
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 0
for res.
- Parameters
-
b A Clutter::Rect. res A Clutter::Rect, or 0
.
- Returns
true
if the intersection of a and b is not empty.
Rect Clutter::Rect::normalise | ( | ) |
Normalizes a Clutter::Rect.
A Clutter::Rect is defined by the area covered by its size; this means that a Clutter::Rect with Clutter::Rect.origin in [ 0, 0 ] and a Clutter::Rect.size of [ 10, 10 ] is equivalent to a Clutter::Rect with Clutter::Rect.origin in [ 10, 10 ] and a Clutter::Rect.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.
void Clutter::Rect::offset | ( | float | d_x, |
float | d_y | ||
) |
Offsets the origin of rect by the given values, after normalizing the rectangle.
- Parameters
-
d_x The horizontal offset value. d_y The vertical offset value.
Computes the smallest possible rectangle capable of fully containing both this rect and b, and returns it.
void Clutter::Rect::swap | ( | Rect& | other) |
Friends And Related Function Documentation
- Parameters
-
lhs The left-hand side rhs The right-hand side
- Returns
- The result
- Parameters
-
lhs The left-hand side rhs The right-hand side
- Returns
- The result
|
related |
A Glib::wrap() method for this object.
- Parameters
-
object The C instance. take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
- Returns
- A C++ instance that wraps this C instance.
Member Data Documentation
|
protected |
The documentation for this class was generated from the following file:
- cluttermm/types.h