Struct sdl2::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
y
w
h

Methods

impl Rect

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

Derived Implementations

impl Show for Rect

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

impl Clone for Rect

fn clone(&self) -> Rect

impl Eq for Rect

fn eq(&self, __arg_0: &Rect) -> bool

fn ne(&self, __arg_0: &Rect) -> bool