00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PAPYRUSREGION_H
00020 #define PAPYRUSREGION_H
00021
00022 #include <papyrus/object.h>
00023
00024 #include <cairomm/cairomm.h>
00025
00026 namespace Papyrus {
00027
00031 class Region: public Object {
00032 public:
00033
00034 Region(double x=0.0, double y=0.0, double w=0.0, double h=0.0);
00035
00036 ~Region();
00037
00038 double x() const;
00039 double y() const;
00040 double width() const;
00041 double height() const;
00042
00043 double xywh(double& x, double& y, double& w, double& h) const;
00044
00045 double left() const;
00046 double right() const;
00047 double top() const;
00048 double bottom() const;
00049 void lrtb(double& l, double& r, double& t, double& b) const;
00050
00051 void center(double& x, double& y) const;
00052
00053
00054 void set_x(double x);
00055 void set_y(double y);
00056 void set_width(double w);
00057 void set_height(double h);
00058 void set_xywh(double x, double y, double w, double h);
00059
00060 bool include(const Region& other);
00061 bool include(double x, double y);
00062 bool include_x(double x);
00063 bool include_y(double y);
00064
00065 void left_bottom(double& l, double& b) const;
00066 void right_top(double& r, double& t) const;
00067
00068 Region& operator=(const Region& other);
00069
00071 bool operator==(const Region& other) const;
00072
00073 bool operator!=(const Region& other) const {
00074 return !(*this == other);
00075 }
00076
00078 bool operator<(const Region& other) const;
00079
00080 bool operator<=(const Region& other) const;
00081
00083 bool operator>(const Region& other) const;
00084
00085 bool operator>=(const Region& other) const;
00086
00088 bool is_inside(double x, double y) const ;
00089
00091 bool is_interior(double x, double y) const ;
00092
00094 bool is_boundary(double x, double y) const ;
00095
00096 void transform(const Cairo::Matrix& matrix);
00097
00098 protected:
00099 double m_x, m_y, m_w, m_h;
00100 };
00101
00102 }
00103
00104 #endif