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.