Struct conrod::Rect
[−]
[src]
pub struct Rect { pub x: Bounds, pub y: Bounds, }
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: Bounds
The start and end positions of the Rectangle on the x axis.
y: Bounds
The start and end positions of the Rectangle on the y axis.
Methods
impl Rect
[src]
fn from_xy_dim(xy: Point, dim: Dimensions) -> Rect
Construct a Rect from a given Point
and Dimensions
.
fn overlap(self, other: Rect) -> Option<Rect>
The Rect representing the area in which two Rects overlap.
fn max(self, other: Rect) -> Rect
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 shift_x(self, x: Scalar) -> Rect
Shift the Rect along the x axis.
fn shift_y(self, y: Scalar) -> Rect
Shift the Rect along the y axis.
fn shift(self, xy: Point) -> Rect
Shift the Rect by the given Point.
fn is_over(&self, xy: Point) -> bool
Does the given point touch the Rectangle.
fn sub_frame(self, frame: Scalar) -> Rect
Shorten the x and y lengths by the given Scalar amount.
fn add_frame(self, frame: Scalar) -> Rect
Lengthen the x and y lengths by the given Scalar amount.
fn pad_left(self, pad: Scalar) -> Rect
The Rect with some padding applied to the left edge.
fn pad_right(self, pad: Scalar) -> Rect
The Rect with some padding applied to the right edge.
fn pad_bottom(self, pad: Scalar) -> Rect
The rect with some padding applied to the bottom edge.
fn pad_top(self, pad: Scalar) -> Rect
The Rect with some padding applied to the top edge.
fn pad(self, pad: Scalar) -> Rect
The Rect with some padding amount applied to each edge.
fn padding(self, padding: Padding) -> Rect
The Rect with some padding applied.
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
impl Copy for Rect
[src]
impl Add<Rect> for Rect
[src]
type Output = Rect
The resulting type after applying the +
operator
fn add(self, rhs: Rect) -> Rect
The method for the +
operator