Struct conrod::Rect
[−]
[src]
pub struct Rect { pub x: Range, pub y: Range, }
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.
Methods
impl Rect
[src]
fn from_xy_dim(xy: Point, dim: Dimensions) -> Self
Construct a Rect from a given Point
and Dimensions
.
fn from_corners(a: Point, b: Point) -> Self
Construct a Rect from the coordinates of two points.
fn overlap(self, other: Self) -> Option<Self>
The Rect representing the area in which two Rects overlap.
fn max(self, other: Self) -> Self
The Rect that encompass the two given sets of Rect.
fn x(&self) -> Scalar
The position in the middle of the x bounds.
fn y(&self) -> Scalar
The position in the middle of the y bounds.
fn xy(&self) -> Point
The xy position in the middle of the bounds.
fn x_y(&self) -> (Scalar, Scalar)
The centered x and y coordinates as a tuple.
fn w(&self) -> Scalar
The width of the Rect.
fn h(&self) -> Scalar
The height of the Rect.
fn dim(&self) -> Dimensions
The total dimensions of the Rect.
fn w_h(&self) -> (Scalar, Scalar)
The width and height of the Rect as a tuple.
fn xy_dim(&self) -> (Point, Dimensions)
Convert the Rect to a Point
and Dimensions
.
fn x_y_w_h(&self) -> (Scalar, Scalar, Scalar, Scalar)
The Rect's centered coordinates and dimensions in a tuple.
fn len(&self) -> Scalar
The length of the longest side of the rectangle.
fn bottom(&self) -> Scalar
The Rect's lowest y value.
fn top(&self) -> Scalar
The Rect's highest y value.
fn left(&self) -> Scalar
The Rect's lowest x value.
fn right(&self) -> Scalar
The Rect's highest x value.
fn top_left(&self) -> Point
The top left corner Point.
fn bottom_left(&self) -> Point
The bottom left corner Point.
fn top_right(&self) -> Point
The top right corner Point.
fn bottom_right(&self) -> Point
The bottom right corner Point.
fn l_r_b_t(&self) -> (Scalar, Scalar, Scalar, Scalar)
The edges of the Rect in a tuple (top, bottom, left, right).
fn l_t_w_h(&self) -> (Scalar, Scalar, Scalar, Scalar)
The left and top edges of the Rect along with the width and height.
fn l_b_w_h(&self) -> (Scalar, Scalar, Scalar, Scalar)
The left and bottom edges of the Rect along with the width and height.
fn shift_x(self, x: Scalar) -> Self
Shift the Rect along the x axis.
fn shift_y(self, y: Scalar) -> Self
Shift the Rect along the y axis.
fn shift(self, xy: Point) -> Self
Shift the Rect by the given Point.
fn is_over(&self, xy: Point) -> bool
Does the given point touch the Rectangle.
fn pad_left(self, pad: Scalar) -> Self
The Rect with some padding applied to the left edge.
fn pad_right(self, pad: Scalar) -> Self
The Rect with some padding applied to the right edge.
fn pad_bottom(self, pad: Scalar) -> Self
The rect with some padding applied to the bottom edge.
fn pad_top(self, pad: Scalar) -> Self
The Rect with some padding applied to the top edge.
fn pad(self, pad: Scalar) -> Self
The Rect with some padding amount applied to each edge.
fn padding(self, padding: Padding) -> Self
The Rect with some padding applied.
fn stretch_to_point(self, point: Point) -> Self
Stretches the closest edge(s) to the given point if the point lies outside of the Rect area.
fn left_of(self, other: Self) -> Self
Align self
's right edge with the left edge of the other
Rect.
fn right_of(self, other: Self) -> Self
Align self
's left edge with the right dge of the other
Rect.
fn below(self, other: Self) -> Self
Align self
's top edge with the bottom edge of the other
Rect.
fn above(self, other: Self) -> Self
Align self
's bottom edge with the top edge of the other
Rect.
fn align_left_of(self, other: Self) -> Self
Align self
's left edge with the left edge of the other
Rect.
fn align_middle_x_of(self, other: Self) -> Self
Align the middle of self
with the middle of the other
Rect along the x axis.
fn align_right_of(self, other: Self) -> Self
Align self
's right edge with the right edge of the other
Rect.
fn align_bottom_of(self, other: Self) -> Self
Align self
's bottom edge with the bottom edge of the other
Rect.
fn align_middle_y_of(self, other: Self) -> Self
Align the middle of self
with the middle of the other
Rect along the y axis.
fn align_top_of(self, other: Self) -> Self
Align self
's top edge with the top edge of the other
Rect.
fn top_left_of(self, other: Self) -> Self
Place self
along the top left edges of the other
Rect.
fn top_right_of(self, other: Self) -> Self
Place self
along the top right edges of the other
Rect.
fn bottom_left_of(self, other: Self) -> Self
Place self
along the bottom left edges of the other
Rect.
fn bottom_right_of(self, other: Self) -> Self
Place self
along the bottom right edges of the other
Rect.
fn mid_top_of(self, other: Self) -> Self
Place self
in the middle of the top edge of the other
Rect.
fn mid_bottom_of(self, other: Self) -> Self
Place self
in the middle of the bottom edge of the other
Rect.
fn mid_left_of(self, other: Self) -> Self
Place self
in the middle of the left edge of the other
Rect.
fn mid_right_of(self, other: Self) -> Self
Place self
in the middle of the right edge of the other
Rect.
fn middle_of(self, other: Self) -> Self
Place self
directly in the middle of the other
Rect.
fn closest_corner(&self, xy: Point) -> Corner
Return the Corner of self
that is closest to the given Point.
Trait Implementations
impl PartialEq for Rect
[src]
fn eq(&self, __arg_0: &Rect) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Rect) -> bool
This method tests for !=
.
impl Debug for Rect
[src]
impl Clone for Rect
[src]
fn clone(&self) -> Rect
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more