4 #define MIN(a,b) (a < b ? a : b)
5 #define MAX(a,b) (a > b ? a : b)
11 eSize( int w, int h );
19 void setWidth( int w );
20 void setHeight( int h );
23 eSize expandedTo( const eSize & ) const;
24 eSize boundedTo( const eSize & ) const;
29 eSize &operator+=( const eSize & );
30 eSize &operator-=( const eSize & );
31 eSize &operator*=( int c );
32 eSize &operator*=( double c );
33 eSize &operator/=( int c );
34 eSize &operator/=( double c );
36 friend inline bool operator==( const eSize &, const eSize & );
37 friend inline bool operator!=( const eSize &, const eSize & );
38 friend inline eSize operator+( const eSize &, const eSize & );
39 friend inline eSize operator-( const eSize &, const eSize & );
40 friend inline eSize operator*( const eSize &, int );
41 friend inline eSize operator*( int, const eSize & );
42 friend inline eSize operator*( const eSize &, double );
43 friend inline eSize operator*( double, const eSize & );
44 friend inline eSize operator/( const eSize &, int );
45 friend inline eSize operator/( const eSize &, double );
53 /*****************************************************************************
54 eSize inline functions
55 *****************************************************************************/
60 inline eSize::eSize( int w, int h )
63 inline bool eSize::isNull() const
64 { return wd==0 && ht==0; }
66 inline bool eSize::isEmpty() const
67 { return wd<1 || ht<1; }
69 inline bool eSize::isValid() const
70 { return wd>=0 && ht>=0; }
72 inline int eSize::width() const
75 inline int eSize::height() const
78 inline void eSize::setWidth( int w )
81 inline void eSize::setHeight( int h )
84 inline int &eSize::rwidth()
87 inline int &eSize::rheight()
90 inline eSize &eSize::operator+=( const eSize &s )
91 { wd+=s.wd; ht+=s.ht; return *this; }
93 inline eSize &eSize::operator-=( const eSize &s )
94 { wd-=s.wd; ht-=s.ht; return *this; }
96 inline eSize &eSize::operator*=( int c )
97 { wd*=c; ht*=c; return *this; }
99 inline eSize &eSize::operator*=( double c )
100 { wd=(int)(wd*c); ht=(int)(ht*c); return *this; }
102 inline bool operator==( const eSize &s1, const eSize &s2 )
103 { return s1.wd == s2.wd && s1.ht == s2.ht; }
105 inline bool operator!=( const eSize &s1, const eSize &s2 )
106 { return s1.wd != s2.wd || s1.ht != s2.ht; }
108 inline eSize operator+( const eSize & s1, const eSize & s2 )
109 { return eSize(s1.wd+s2.wd, s1.ht+s2.ht); }
111 inline eSize operator-( const eSize &s1, const eSize &s2 )
112 { return eSize(s1.wd-s2.wd, s1.ht-s2.ht); }
114 inline eSize operator*( const eSize &s, int c )
115 { return eSize(s.wd*c, s.ht*c); }
117 inline eSize operator*( int c, const eSize &s )
118 { return eSize(s.wd*c, s.ht*c); }
120 inline eSize operator*( const eSize &s, double c )
121 { return eSize((int)(s.wd*c), (int)(s.ht*c)); }
123 inline eSize operator*( double c, const eSize &s )
124 { return eSize((int)(s.wd*c), (int)(s.ht*c)); }
126 inline eSize &eSize::operator/=( int c )
132 inline eSize &eSize::operator/=( double c )
134 wd=(int)(wd/c); ht=(int)(ht/c);
138 inline eSize operator/( const eSize &s, int c )
140 return eSize(s.wd/c, s.ht/c);
143 inline eSize operator/( const eSize &s, double c )
145 return eSize((int)(s.wd/c), (int)(s.ht/c));
148 inline eSize eSize::expandedTo( const eSize & otherSize ) const
150 return eSize( MAX(wd,otherSize.wd), MAX(ht,otherSize.ht) );
153 inline eSize eSize::boundedTo( const eSize & otherSize ) const
155 return eSize( MIN(wd,otherSize.wd), MIN(ht,otherSize.ht) );
158 inline void eSize::transpose()