Struct shapes::Rect [] [src]

pub struct Rect {
    pub pos: Point,
    pub size: Size,
}

A rectangle.

Fields

The position of the top left corner of the rectangle.

The width and height of the rectangle.

Methods

impl Rect
[src]

[src]

Returns the position of the bottom side of the rectangle.

[src]

Computes a rectangle with quadruple the surface area of self and with center (self.x, self.y).

[src]

Compute whether or not the point is inside the rectangle.

[src]

Create a rectangle that circumscribes the given circle.

[src]

Create a square rectangle with sides of length len and top left corner at pos.

[src]

Returns the position of the left side of the rectangle.

[src]

Computes a rectangle whose perimeter forms the inside edge of margin with size m for self.

[src]

Computes a rectangle translated (slid) in the direction of the vector a distance relative to the size of the rectangle. For example, self.relative([1.0, 1.0]) returns a rectangle one rectangle to the right and down from the original.

[src]

Returns the position of the right side of the rectangle.

[src]

Computes a scaled rectangle with the same position as self.

[src]

Returns the position of the top side of the rectangle.

Trait Implementations

impl Clone for Rect
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Rect
[src]

impl Debug for Rect
[src]

[src]

Formats the value using the given formatter.

impl<P: Into<Point>, S: Into<Size>> From<(P, S)> for Rect
[src]

[src]

Creates a rectangle from the position of its top left corner and its size.

impl From<[Scalar; 4]> for Rect
[src]

[src]

Creates a rectangle from an array.

impl From<(Scalar, Scalar, Scalar, Scalar)> for Rect
[src]

[src]

Performs the conversion.