Struct sdl2_sys::rect::Rect [] [src]

pub struct Rect {
    pub x: i32,
    pub y: i32,
    pub w: i32,
    pub h: i32,
}

A structure that defines a rectangle, with the origin at the upper left.

Fields

x: i32 y: i32 w: i32 h: i32

Methods

impl Rect
[src]

fn new(x: i32, y: i32, w: i32, h: i32) -> Rect

fn from_enclose_points(points: &[Point], clip: Option<Rect>) -> Option<Rect>

Calculate a minimal rectangle enclosing a set of points.

fn is_empty(&self) -> bool

Check whether a rectangle has no area.

fn has_intersection(&self, other: &Rect) -> bool

Determine whether two rectangles intersect.

fn intersection(&self, other: &Rect) -> Option<Rect>

Calculate the intersection of two rectangles.

fn union(&self, other: &Rect) -> Rect

Calculate the union of two rectangles.

fn intersect_line(&self, start: &Point, end: &Point) -> Option<(Point, Point)>

Calculate the intersection of a rectangle and line segment. return points of intersection.

Trait Implementations

impl Copy for Rect
[src]

impl Debug for Rect
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

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 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 !=.