Trait rect::Rect [] [src]

pub trait Rect: Sized {
    type Scalar: Float;
    fn from_x_y_w_h(
        _: Self::Scalar,
        _: Self::Scalar,
        _: Self::Scalar,
        _: Self::Scalar
    ) -> Self; fn x(&self) -> Self::Scalar; fn y(&self) -> Self::Scalar; fn w(&self) -> Self::Scalar; fn h(&self) -> Self::Scalar; fn set_x(&mut self, val: Self::Scalar); fn set_y(&mut self, val: Self::Scalar); fn set_w(&mut self, val: Self::Scalar); fn set_h(&mut self, val: Self::Scalar); fn from_u32(rect: [u32; 4]) -> Self { ... } fn from_i32(rect: [i32; 4]) -> Self { ... } fn xy(&self) -> (Self::Scalar, Self::Scalar) { ... } fn wh(&self) -> (Self::Scalar, Self::Scalar) { ... } fn xw(&self) -> (Self::Scalar, Self::Scalar) { ... } fn yh(&self) -> (Self::Scalar, Self::Scalar) { ... } fn x1x2(&self) -> (Self::Scalar, Self::Scalar) { ... } fn y1y2(&self) -> (Self::Scalar, Self::Scalar) { ... } fn p1p2(&self) -> ([Self::Scalar; 2], [Self::Scalar; 2]) { ... } fn xywh(&self) -> (Self::Scalar, Self::Scalar, Self::Scalar, Self::Scalar) { ... } fn center(&self) -> [Self::Scalar; 2] { ... } fn is_empty(&self) -> bool { ... } fn margin(&self, val: Self::Scalar) -> Self { ... } fn split_left(
        &self,
        val: Self::Scalar,
        factor: Self::Scalar
    ) -> (Self, Self) { ... } fn split_right(
        &self,
        val: Self::Scalar,
        factor: Self::Scalar
    ) -> (Self, Self) { ... } fn split_top(&self, val: Self::Scalar, factor: Self::Scalar) -> (Self, Self) { ... } fn split_bottom(
        &self,
        val: Self::Scalar,
        factor: Self::Scalar
    ) -> (Self, Self) { ... } }

Helper methods for computing simple rectangle layout.

Associated Types

The internal scalar type.

Required Methods

Creates new rectangle from x, y, w, h.

Gets x.

Gets y.

Gets w.

Gets h.

Sets x.

Sets y.

Sets w.

Sets h.

Provided Methods

Converts from u32 rectangle.

Converts from i32 rectangle.

Returns x and y.

Returns w and h.

Return x and w.

Returns y and h.

Returns left and right.

Returns top and bottom.

Returns upper left and lower right corner.

Returns x, y, w, h.

Returns the center of the rectangle.

Returns true if the rectangle is empty.

Computes a margin rectangle. If the margin is too large, an empty rectangle in the middle is returned.

Splits from the left side of rectangle up to a factor.

Splits from the right side of rectangle.

Splits from the top side of rectangle.

Splits from the bottom side of the rectangle.

Implementors