summaryrefslogtreecommitdiff
path: root/FL/Fl_Rect.H
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2018-03-10 00:46:12 +0000
committerMatthias Melcher <fltk@matthiasm.com>2018-03-10 00:46:12 +0000
commitc0cbf0fbde0ac33d3743a6d50bf0fa9f6664a008 (patch)
tree8fb9b3e1db8bfef8052deb549af986023fc86915 /FL/Fl_Rect.H
parentdc2fb581b76ea84ebd70a7ced1291dd26b40fc71 (diff)
Android: crude graphics clipping
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12726 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_Rect.H')
-rw-r--r--FL/Fl_Rect.H12
1 files changed, 12 insertions, 0 deletions
diff --git a/FL/Fl_Rect.H b/FL/Fl_Rect.H
index 7e7d376e0..307410ef7 100644
--- a/FL/Fl_Rect.H
+++ b/FL/Fl_Rect.H
@@ -60,6 +60,18 @@ public:
Fl_Rect (const Fl_Widget* const widget)
: x_(widget->x()), y_(widget->y()), w_(widget->w()), h_(widget->h()) {}
+ /** Return 1 if the rectangle is empty, width or height are 0 */
+ int is_empty() { return (w_==0)||(h_==0); }
+
+ /** Set the position and size */
+ void set(int x, int y, int w, int h) { x_=x; y_=y; w_=w; h_=h; }
+
+ /** return 0 if the rectangles are different, or 1 if they are the same */
+ int equals(int x, int y, int w, int h) { return ( (x_==x) && (y_==y) && (w_==w) && (h_==h) ); }
+
+ /** Set the position and size to zero, making this rect empty */
+ void clear() { x_ = y_ = w_ = h_ = 0; }
+
int x() const { return x_; } ///< gets the x coordinate (left edge)
int y() const { return y_; } ///< gets the y coordinate (top edge)
int w() const { return w_; } ///< gets the width