Struct clutter::Rect [−][src]
pub struct Rect(_);
Implementations
impl Rect
[src]
pub fn alloc() -> Rect
[src]
Creates a new, empty Rect
.
You can use Rect::init
to initialize the returned rectangle,
for instance:
rect = clutter_rect_init (clutter_rect_alloc (), x, y, width, height);
Returns
the newly allocated Rect
.
Use Rect::free
to free its resources
pub fn clamp_to_pixel(&mut self)
[src]
Rounds the origin of self
downwards to the nearest integer, and rounds
the size of self
upwards to the nearest integer, so that self
is
updated to the smallest rectangle capable of fully containing the
original, fractional rectangle.
pub fn contains_point(&mut self, point: &mut Point) -> bool
[src]
Checks whether point
is contained by self
, after normalizing the
rectangle.
point
the point to check
Returns
true
if the point
is contained by self
.
pub fn contains_rect(&mut self, b: &mut Rect) -> bool
[src]
Checks whether self
contains b
.
The first rectangle contains the second if the union of the
two Rect
is equal to the first rectangle.
b
a Rect
Returns
true
if the first rectangle contains the second.
pub fn equals(&mut self, b: &mut Rect) -> bool
[src]
Checks whether self
and b
are equals.
This function will normalize both self
and b
before comparing
their origin and size.
b
a Rect
Returns
true
if the rectangles match in origin and size.
pub fn get_center(&mut self) -> Point
[src]
Retrieves the center of self
, after normalizing the rectangle,
and updates center
with the correct coordinates.
center
a Point
pub fn get_height(&mut self) -> f32
[src]
pub fn get_width(&mut self) -> f32
[src]
pub fn get_x(&mut self) -> f32
[src]
Retrieves the X coordinate of the origin of self
.
Returns
the X coordinate of the origin of the rectangle
pub fn get_y(&mut self) -> f32
[src]
Retrieves the Y coordinate of the origin of self
.
Returns
the Y coordinate of the origin of the rectangle
pub fn init(&mut self, x: f32, y: f32, width: f32, height: f32) -> Option<Rect>
[src]
Initializes a Rect
with the given origin and size.
x
X coordinate of the origin
y
Y coordinate of the origin
width
width of the rectangle
height
height of the rectangle
Returns
the updated rectangle
pub fn inset(&mut self, d_x: f32, d_y: f32)
[src]
Normalizes the self
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.
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
pub fn intersection(&mut self, b: &mut Rect) -> Option<Rect>
[src]
Computes the intersection of self
and b
, and places it in res
, if res
is not None
.
This function will normalize both self
and b
prior to computing their
intersection.
This function can be used to simply check if the intersection of self
and b
is not empty, by using None
for res
.
b
a Rect
res
a Rect
, or None
Returns
true
if the intersection of self
and b
is not empty
pub fn normalize(&mut self) -> Option<Rect>
[src]
Normalizes a Rect
.
A Rect
is defined by the area covered by its size; this means
that a Rect
with Rect.origin
in [ 0, 0 ] and a
Rect.size
of [ 10, 10 ] is equivalent to a Rect
with
Rect.origin
in [ 10, 10 ] and a Rect.size
of [ -10, -10 ].
This function is useful to ensure that a rectangle has positive width
and height; it will modify the passed self
and normalize its size.
pub fn offset(&mut self, d_x: f32, d_y: f32)
[src]
Offsets the origin of self
by the given values, after normalizing
the rectangle.
d_x
the horizontal offset value
d_y
the vertical offset value
pub fn union(&mut self, b: &mut Rect) -> Rect
[src]
Computes the smallest possible rectangle capable of fully containing
both self
and b
, and places it into res
.
This function will normalize both self
and b
prior to computing their
union.
b
a Rect
res
a Rect
pub fn zero() -> Option<Rect>
[src]
A Rect
with Rect.origin
set at (0, 0) and a size
of 0.
The returned value can be used as a guard.
Returns
a rectangle with origin in (0, 0) and a size of 0.
The returned Rect
is owned by Clutter and it should not
be modified or freed.
Trait Implementations
impl Clone for Rect
[src]
impl Debug for Rect
[src]
impl Eq for Rect
[src]
impl Hash for Rect
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Rect
[src]
fn cmp(&self, other: &Rect) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Rect> for Rect
[src]
impl PartialOrd<Rect> for Rect
[src]
fn partial_cmp(&self, other: &Rect) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StaticType for Rect
[src]
fn static_type() -> Type
[src]
impl StructuralEq for Rect
[src]
impl StructuralPartialEq for Rect
[src]
Auto Trait Implementations
impl RefUnwindSafe for Rect
impl !Send for Rect
impl !Sync for Rect
impl Unpin for Rect
impl UnwindSafe for Rect
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToSendValue for T where
T: SetValue + Send + ToValue + ?Sized,
[src]
T: SetValue + Send + ToValue + ?Sized,
pub fn to_send_value(&self) -> SendValue
[src]
impl<T> ToValue for T where
T: SetValue + ?Sized,
[src]
T: SetValue + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,