[−][src]Struct conrod_core::position::rect::Rect
Defines a Rectangle's bounds across the x and y axes.
This is a conrod-specific Rectangle in that it's designed to help with layout.
Fields
x: Range
The start and end positions of the Rectangle on the x axis.
y: Range
The start and end positions of the Rectangle on the y axis.
Implementations
impl Rect
[src]
pub fn from_xy_dim(xy: Point, dim: Dimensions) -> Self
[src]
Construct a Rect from a given Point
and Dimensions
.
pub fn from_corners(a: Point, b: Point) -> Self
[src]
Construct a Rect from the coordinates of two points.
pub fn overlap(self, other: Self) -> Option<Self>
[src]
The Rect representing the area in which two Rects overlap.
pub fn max(self, other: Self) -> Self
[src]
The Rect that encompass the two given sets of Rect.
pub fn x(&self) -> Scalar
[src]
The position in the middle of the x bounds.
pub fn y(&self) -> Scalar
[src]
The position in the middle of the y bounds.
pub fn xy(&self) -> Point
[src]
The xy position in the middle of the bounds.
pub fn x_y(&self) -> (Scalar, Scalar)
[src]
The centered x and y coordinates as a tuple.
pub fn w(&self) -> Scalar
[src]
The width of the Rect.
pub fn h(&self) -> Scalar
[src]
The height of the Rect.
pub fn dim(&self) -> Dimensions
[src]
The total dimensions of the Rect.
pub fn w_h(&self) -> (Scalar, Scalar)
[src]
The width and height of the Rect as a tuple.
pub fn xy_dim(&self) -> (Point, Dimensions)
[src]
Convert the Rect to a Point
and Dimensions
.
pub fn x_y_w_h(&self) -> (Scalar, Scalar, Scalar, Scalar)
[src]
The Rect's centered coordinates and dimensions in a tuple.
pub fn len(&self) -> Scalar
[src]
The length of the longest side of the rectangle.
pub fn bottom(&self) -> Scalar
[src]
The Rect's lowest y value.
pub fn top(&self) -> Scalar
[src]
The Rect's highest y value.
pub fn left(&self) -> Scalar
[src]
The Rect's lowest x value.
pub fn right(&self) -> Scalar
[src]
The Rect's highest x value.
pub fn top_left(&self) -> Point
[src]
The top left corner Point.
pub fn bottom_left(&self) -> Point
[src]
The bottom left corner Point.
pub fn top_right(&self) -> Point
[src]
The top right corner Point.
pub fn bottom_right(&self) -> Point
[src]
The bottom right corner Point.
pub fn l_r_b_t(&self) -> (Scalar, Scalar, Scalar, Scalar)
[src]
The edges of the Rect in a tuple (top, bottom, left, right).
pub fn l_t_w_h(&self) -> (Scalar, Scalar, Scalar, Scalar)
[src]
The left and top edges of the Rect along with the width and height.
pub fn l_b_w_h(&self) -> (Scalar, Scalar, Scalar, Scalar)
[src]
The left and bottom edges of the Rect along with the width and height.
pub fn shift_x(self, x: Scalar) -> Self
[src]
Shift the Rect along the x axis.
pub fn shift_y(self, y: Scalar) -> Self
[src]
Shift the Rect along the y axis.
pub fn shift(self, xy: Point) -> Self
[src]
Shift the Rect by the given Point.
pub fn relative_to_x(self, x: Scalar) -> Self
[src]
Returns a Rect
with a position relative to the given position on the x axis.
pub fn relative_to_y(self, y: Scalar) -> Self
[src]
Returns a Rect
with a position relative to the given position on the y axis.
pub fn relative_to(self, xy: Point) -> Self
[src]
Returns a Rect
with a position relative to the given position.
pub fn is_over(&self, xy: Point) -> bool
[src]
Does the given point touch the Rectangle.
pub fn pad_left(self, pad: Scalar) -> Self
[src]
The Rect with some padding applied to the left edge.
pub fn pad_right(self, pad: Scalar) -> Self
[src]
The Rect with some padding applied to the right edge.
pub fn pad_bottom(self, pad: Scalar) -> Self
[src]
The rect with some padding applied to the bottom edge.
pub fn pad_top(self, pad: Scalar) -> Self
[src]
The Rect with some padding applied to the top edge.
pub fn pad(self, pad: Scalar) -> Self
[src]
The Rect with some padding amount applied to each edge.
pub fn padding(self, padding: Padding) -> Self
[src]
The Rect with some padding applied.
pub fn stretch_to_point(self, point: Point) -> Self
[src]
Stretches the closest edge(s) to the given point if the point lies outside of the Rect area.
pub fn left_of(self, other: Self) -> Self
[src]
Align self
's right edge with the left edge of the other
Rect.
pub fn right_of(self, other: Self) -> Self
[src]
Align self
's left edge with the right dge of the other
Rect.
pub fn below(self, other: Self) -> Self
[src]
Align self
's top edge with the bottom edge of the other
Rect.
pub fn above(self, other: Self) -> Self
[src]
Align self
's bottom edge with the top edge of the other
Rect.
pub fn align_x_of(self, align: Align, other: Self) -> Self
[src]
Align self
to other
along the x axis in accordance with the given Align
variant.
pub fn align_y_of(self, align: Align, other: Self) -> Self
[src]
Align self
to other
along the y axis in accordance with the given Align
variant.
pub fn align_left_of(self, other: Self) -> Self
[src]
Align self
's left edge with the left edge of the other
Rect.
pub fn align_middle_x_of(self, other: Self) -> Self
[src]
Align the middle of self
with the middle of the other
Rect along the x axis.
pub fn align_right_of(self, other: Self) -> Self
[src]
Align self
's right edge with the right edge of the other
Rect.
pub fn align_bottom_of(self, other: Self) -> Self
[src]
Align self
's bottom edge with the bottom edge of the other
Rect.
pub fn align_middle_y_of(self, other: Self) -> Self
[src]
Align the middle of self
with the middle of the other
Rect along the y axis.
pub fn align_top_of(self, other: Self) -> Self
[src]
Align self
's top edge with the top edge of the other
Rect.
pub fn top_left_of(self, other: Self) -> Self
[src]
Place self
along the top left edges of the other
Rect.
pub fn top_right_of(self, other: Self) -> Self
[src]
Place self
along the top right edges of the other
Rect.
pub fn bottom_left_of(self, other: Self) -> Self
[src]
Place self
along the bottom left edges of the other
Rect.
pub fn bottom_right_of(self, other: Self) -> Self
[src]
Place self
along the bottom right edges of the other
Rect.
pub fn mid_top_of(self, other: Self) -> Self
[src]
Place self
in the middle of the top edge of the other
Rect.
pub fn mid_bottom_of(self, other: Self) -> Self
[src]
Place self
in the middle of the bottom edge of the other
Rect.
pub fn mid_left_of(self, other: Self) -> Self
[src]
Place self
in the middle of the left edge of the other
Rect.
pub fn mid_right_of(self, other: Self) -> Self
[src]
Place self
in the middle of the right edge of the other
Rect.
pub fn middle_of(self, other: Self) -> Self
[src]
Place self
directly in the middle of the other
Rect.
pub fn closest_corner(&self, xy: Point) -> Corner
[src]
Return the Corner of self
that is closest to the given Point.
Trait Implementations
impl Clone for Rect
[src]
impl Copy for Rect
[src]
impl Debug for Rect
[src]
impl PartialEq<Rect> 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,
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> Style for T where
T: Any + Debug + PartialEq<T>,
[src]
T: Any + Debug + PartialEq<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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.
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>,