#include "Display.h" static inline int MAX(int a,int b) { return (a < b) ? b : a; } static inline int MIN(int a,int b) { return (a < b) ? a : b; } Rect Rect::enclose(const Rect &r) const { return Rect(MIN(r.r1,r1),MIN(r.c1,c1),MAX(r.r2,r2),MAX(r.c2,c2)); } Rect Rect::intersect(const Rect &r) const { return Rect(MAX(r.r1,r1),MAX(r.c1,c1),MIN(r.r2,r2),MIN(r.c2,c2)); } Rect Rect::expand(short i) const { return Rect(r1 - i,c1 - i,r2 + i,c2 + i); } Rect Rect::moverel(short rws,short cls) const { return Rect(r1 + rws,c1 + cls,r2 + rws,c2 + cls); } Rect::Rect(Point p1,int cols,int rows) { r1 = p1.row; c1 = p1.col; r2 = r1 + rows - 1; c2 = c1 + cols - 1; }