git-svn-id: svn://db.shs.com.ru/pip@564 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -28,7 +28,7 @@ public:
|
||||
Type x;
|
||||
Type y;
|
||||
|
||||
PIPoint() {x = y = 0;}
|
||||
PIPoint() {x = y = Type();}
|
||||
PIPoint(Type x_, Type y_) {set(x_, y_);}
|
||||
|
||||
PIPoint<Type> & set(Type x_, Type y_) {x = x_; y = y_; return *this;}
|
||||
@@ -54,6 +54,21 @@ public:
|
||||
template<typename Type>
|
||||
PICout operator <<(PICout & s, const PIPoint<Type> & v) {s.setControl(0, true); s << '{' << v.x << ", " << v.y << '}'; s.restoreControl(); return s;}
|
||||
|
||||
template<typename Type>
|
||||
inline PIByteArray & operator <<(PIByteArray & s, PIPoint<Type> v) {s << v.x << v.y; return s;}
|
||||
|
||||
template<typename Type>
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIPoint<Type> & v) {s >> v.x >> v.y; return s;}
|
||||
|
||||
|
||||
typedef PIPoint<int> PIPointi;
|
||||
typedef PIPoint<uint> PIPointu;
|
||||
typedef PIPoint<float> PIPointf;
|
||||
typedef PIPoint<double> PIPointd;
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename Type>
|
||||
class PIP_EXPORT PIRect {
|
||||
public:
|
||||
@@ -62,7 +77,7 @@ public:
|
||||
Type x1;
|
||||
Type y1;
|
||||
|
||||
PIRect() {x0 = y0 = x1 = y1 = 0;}
|
||||
PIRect() {x0 = y0 = x1 = y1 = Type();}
|
||||
PIRect(Type x, Type y, Type w, Type h) {set(x, y, w, h);}
|
||||
PIRect(const PIPoint<Type> & tl, const PIPoint<Type> & br) {set(tl.x, tl.y, br.x, br.y);}
|
||||
PIRect(const PIPoint<Type> & p0, const PIPoint<Type> & p1, const PIPoint<Type> & p2) {set(piMin<Type>(p0.x, p1.x, p2.x), piMin<Type>(p0.y, p1.y, p2.y),
|
||||
@@ -124,10 +139,12 @@ public:
|
||||
template<typename Type>
|
||||
PICout operator <<(PICout & s, const PIRect<Type> & v) {s.setControl(0, true); s << '{' << v.x0 << ", " << v.y0 << "; " << v.x1 - v.x0 << ", " << v.y1 - v.y0 << '}'; s.restoreControl(); return s;}
|
||||
|
||||
typedef PIPoint<int> PIPointi;
|
||||
typedef PIPoint<uint> PIPointu;
|
||||
typedef PIPoint<float> PIPointf;
|
||||
typedef PIPoint<double> PIPointd;
|
||||
template<typename Type>
|
||||
inline PIByteArray & operator <<(PIByteArray & s, PIRect<Type> v) {s << v.x0 << v.x1 << v.y0 << v.y1; return s;}
|
||||
|
||||
template<typename Type>
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIRect<Type> & v) {s >> v.x0 >> v.x1 >> v.y0 >> v.y1; return s;}
|
||||
|
||||
|
||||
typedef PIRect<int> PIRecti;
|
||||
typedef PIRect<uint> PIRectu;
|
||||
|
||||
Reference in New Issue
Block a user