gtkmm 4.13.2
|
The location and size of a rectangle region. More...
#include <gdkmm/graphene_rect.h>
Public Member Functions | |
Rect () | |
Constructs an invalid object. More... | |
Rect (graphene_rect_t * castitem, bool make_a_copy=false) | |
Rect (const Rect & src) | |
Rect & | operator= (const Rect & src) |
Rect (Rect && other) noexcept | |
Rect & | operator= (Rect && other) noexcept |
~Rect () noexcept | |
void | swap (Rect & other) noexcept |
graphene_rect_t * | gobj () |
const graphene_rect_t * | gobj () const |
graphene_rect_t * | 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, float y, float width, float height) | |
operator bool () const | |
Checks if this instance is valid. More... | |
Point | get_origin () const |
void | set_origin (const Point & value) |
Size | get_size () const |
void | set_size (const Size & value) |
Point | get_center () const |
Retrieves the coordinates of the center of the given rectangle. More... | |
Point | get_top_left () const |
Retrieves the coordinates of the top-left corner of the given rectangle. More... | |
Point | get_top_right () const |
Retrieves the coordinates of the top-right corner of the given rectangle. More... | |
Point | get_bottom_right () const |
Retrieves the coordinates of the bottom-right corner of the given rectangle. More... | |
Point | get_bottom_left () const |
Retrieves the coordinates of the bottom-left corner of the given rectangle. More... | |
bool | equal (const Rect & b) const |
Checks whether the two given rectangle are equal. More... | |
void | normalize () |
Normalizes the passed rectangle. More... | |
float | get_x () const |
Retrieves the normalized X coordinate of the origin of the given rectangle. More... | |
float | get_y () const |
Retrieves the normalized Y coordinate of the origin of the given rectangle. More... | |
float | get_width () const |
Retrieves the normalized width of the given rectangle. More... | |
float | get_height () const |
Retrieves the normalized height of the given rectangle. More... | |
float | get_area () const |
Compute the area of given normalized rectangle. More... | |
bool | contains_point (const Point & p) const |
Checks whether a #graphene_rect_t contains the given coordinates. More... | |
bool | contains_rect (const Rect & b) const |
Checks whether a #graphene_rect_t fully contains the given rectangle. More... | |
Protected Attributes | |
graphene_rect_t * | gobject_ |
Related Functions | |
(Note that these are not member functions.) | |
void | swap (Rect & lhs, Rect & rhs) noexcept |
Gdk::Graphene::Rect | wrap (graphene_rect_t * object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
The location and size of a rectangle region.
The width and height of a Gdk::Graphene::Rect can be negative; for instance, a Gdk::Graphene::Rect with an origin of [ 0, 0 ] and a size of [ 10, 10 ] is equivalent to a Gdk::Graphene::Rect with an origin of [ 10, 10 ] and a size of [ -10, -10 ].
Application code can normalize rectangles using normalize(); this function will ensure that the width and height of a rectangle are positive values. All functions taking a Gdk::Graphene::Rect as an argument will internally operate on a normalized copy; all functions returning a Gdk::Graphene::Rect will always return a normalized rectangle.
Gdk::Graphene::Rect::Rect | ( | ) |
Constructs an invalid object.
E.g. for output arguments to methods. There is not much you can do with the object before it has been assigned a valid value.
|
explicit |
Gdk::Graphene::Rect::Rect | ( | const Rect & | src | ) |
|
noexcept |
|
noexcept |
Gdk::Graphene::Rect::Rect | ( | float | x, |
float | y, | ||
float | width, | ||
float | height | ||
) |
bool Gdk::Graphene::Rect::contains_point | ( | const Point & | p | ) | const |
Checks whether a #graphene_rect_t contains the given coordinates.
p | A #graphene_point_t. |
true
if the rectangle contains the point. bool Gdk::Graphene::Rect::contains_rect | ( | const Rect & | b | ) | const |
Checks whether a #graphene_rect_t fully contains the given rectangle.
b | A #graphene_rect_t. |
true
if the rectangle a fully contains b. bool Gdk::Graphene::Rect::equal | ( | const Rect & | b | ) | const |
Checks whether the two given rectangle are equal.
b | A #graphene_rect_t. |
true
if the rectangles are equal. float Gdk::Graphene::Rect::get_area | ( | ) | const |
Compute the area of given normalized rectangle.
Point Gdk::Graphene::Rect::get_bottom_left | ( | ) | const |
Retrieves the coordinates of the bottom-left corner of the given rectangle.
Point Gdk::Graphene::Rect::get_bottom_right | ( | ) | const |
Retrieves the coordinates of the bottom-right corner of the given rectangle.
Point Gdk::Graphene::Rect::get_center | ( | ) | const |
Retrieves the coordinates of the center of the given rectangle.
float Gdk::Graphene::Rect::get_height | ( | ) | const |
Retrieves the normalized height of the given rectangle.
Point Gdk::Graphene::Rect::get_origin | ( | ) | const |
Size Gdk::Graphene::Rect::get_size | ( | ) | const |
Point Gdk::Graphene::Rect::get_top_left | ( | ) | const |
Retrieves the coordinates of the top-left corner of the given rectangle.
Point Gdk::Graphene::Rect::get_top_right | ( | ) | const |
Retrieves the coordinates of the top-right corner of the given rectangle.
float Gdk::Graphene::Rect::get_width | ( | ) | const |
Retrieves the normalized width of the given rectangle.
float Gdk::Graphene::Rect::get_x | ( | ) | const |
Retrieves the normalized X coordinate of the origin of the given rectangle.
float Gdk::Graphene::Rect::get_y | ( | ) | const |
Retrieves the normalized Y coordinate of the origin of the given rectangle.
|
inline |
|
inline |
graphene_rect_t * Gdk::Graphene::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 Gdk::Graphene::Rect::normalize | ( | ) |
Normalizes the passed rectangle.
This function ensures that the size of the rectangle is made of positive values, and that the origin is the top-left corner of the rectangle.
|
explicit |
Checks if this instance is valid.
It is valid if and only if it contains a value. For instance,
void Gdk::Graphene::Rect::set_origin | ( | const Point & | value | ) |
void Gdk::Graphene::Rect::set_size | ( | const Size & | value | ) |
|
noexcept |
lhs | The left-hand side |
rhs | The right-hand side |
|
related |
A Glib::wrap() method for this object.
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. |
|
protected |