cluttermm: Clutter::Rect Class Reference

Public Member Functions

 Rect (ClutterRect* gobject, bool make_a_copy=true)
 
 Rect (const Rect& other)
 
Rectoperator= (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

Clutter::Rect::Rect ( ClutterRect *  gobject,
bool  make_a_copy = true 
)
explicit
Clutter::Rect::Rect ( const Rect other)
Clutter::Rect::~Rect ( )
Clutter::Rect::Rect ( float  x = 0,
float  y = 0,
float  width = 0,
float  height = 0 
)
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.

Since cluttermm 1.12:
bool Clutter::Rect::contains_point ( const Point point) const

Checks whether point is contained by rect, after normalizing the rectangle.

Since cluttermm 1.12:
Parameters
pointThe 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.

Since cluttermm 1.12:
Parameters
bA 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

Retrieves the height of rect.

Since cluttermm 1.12:
Returns
The height of the rectangle.
static GType Clutter::Rect::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

float Clutter::Rect::get_width ( ) const

Retrieves the width of rect.

Since cluttermm 1.12:
Returns
The width of the rectangle.
float Clutter::Rect::get_x ( ) const

Retrieves the X coordinate of the origin of rect.

Since cluttermm 1.12:
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.

Since cluttermm 1.12:
Returns
The Y coordinate of the origin of the rectangle.
ClutterRect* Clutter::Rect::gobj ( )
inline

Provides access to the underlying C instance.

const ClutterRect* Clutter::Rect::gobj ( ) const
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.

Since cluttermm 1.12:
Parameters
d_xAn horizontal value; a positive d_x will create an inset rectangle, and a negative value will create a larger rectangle.
d_yA vertical value; a positive d_x will create an inset rectangle, and a negative value will create a larger rectangle.
bool Clutter::Rect::intersection ( const Rect b,
Rect res 
) const

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.

Since cluttermm 1.12:
Parameters
bA Clutter::Rect.
resA 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.

Since cluttermm 1.12:
void Clutter::Rect::offset ( float  d_x,
float  d_y 
)

Offsets the origin of rect by the given values, after normalizing the rectangle.

Since cluttermm 1.12:
Parameters
d_xThe horizontal offset value.
d_yThe vertical offset value.
Rect& Clutter::Rect::operator= ( const Rect other)
Rect Clutter::Rect::rect_union ( const Rect b) const

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

bool operator!= ( const Rect lhs,
const Rect rhs 
)
related
Parameters
lhsThe left-hand side
rhsThe right-hand side
Returns
The result
bool operator== ( const Rect lhs,
const Rect rhs 
)
related
Parameters
lhsThe left-hand side
rhsThe right-hand side
Returns
The result
void swap ( Rect lhs,
Rect rhs 
)
related
Parameters
lhsThe left-hand side
rhsThe right-hand side
Clutter::Rect wrap ( ClutterRect *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse 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

ClutterRect* Clutter::Rect::gobject_
protected

The documentation for this class was generated from the following file:
  • cluttermm/types.h