1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
|
/*
/--------------------------------------------------------------------
|
| $Id: plpoint.h,v 1.10 2004/10/02 22:23:12 uzadow Exp $
|
| Copyright (c) 1996-2002 Ulrich von Zadow
|
\--------------------------------------------------------------------
*/
#ifndef INCL_PLPOINT
#define INCL_PLPOINT
//! Simple point class for 2d integer coordinate manipulations. This class
//! contains only inline functions and nothing virtual. Its member variables
//! are public.
class PLPoint
{
public:
//!
int x;
//!
int y;
//!
PLPoint
();
//!
PLPoint
( int X,
int Y
);
//!
bool operator ==
( const PLPoint & pt
) const;
//!
bool operator !=
( const PLPoint & pt
) const;
//!
void operator +=
( const PLPoint & pt
);
//!
void operator -=
( const PLPoint & pt
);
//!
PLPoint operator -
() const;
//!
PLPoint operator +
( const PLPoint & pt
) const;
//!
PLPoint operator -
( const PLPoint & pt
) const;
//!
PLPoint operator /
( double f
) const;
//!
PLPoint operator *
( double f
) const;
};
inline PLPoint::PLPoint
()
{}
inline PLPoint::PLPoint
( int X,
int Y
)
{
x = X;
y = Y;
}
inline bool PLPoint::operator ==
( const PLPoint & pt
) const
{
return (x == pt.x && y == pt.y);
}
inline bool PLPoint::operator !=
( const PLPoint & pt
) const
{
return (x != pt.x || y != pt.y);
}
inline void PLPoint::operator +=
( const PLPoint & pt
)
{
x += pt.x;
y += pt.y;
}
inline void PLPoint::operator -=
( const PLPoint & pt
)
{
x -= pt.x;
y -= pt.y;
}
inline PLPoint PLPoint::operator -
() const
{
return PLPoint(-x, -y);
}
inline PLPoint PLPoint::operator +
( const PLPoint & pt
) const
{
return PLPoint(x + pt.x, y + pt.y);
}
inline PLPoint PLPoint::operator -
( const PLPoint & pt
) const
{
return PLPoint(x - pt.x, y - pt.y);
}
inline PLPoint PLPoint::operator /
( double f
) const
{
return PLPoint (int(x/f), int(y/f));
}
inline PLPoint PLPoint::operator *
( double f
) const
{
return PLPoint (int(x*f), int(y*f));
}
#endif
/*
/--------------------------------------------------------------------
|
| $Log: plpoint.h,v $
| Revision 1.10 2004/10/02 22:23:12 uzadow
| - configure and Makefile cleanups\n- Pixelformat enhancements for several filters\n- Added PLBmpBase:Dump\n- Added PLBmpBase::GetPixelNn()-methods\n- Changed default unix byte order to BGR
|
| Revision 1.9 2004/06/06 12:56:38 uzadow
| Doxygenified documentation.
|
| Revision 1.8 2002/03/31 13:36:42 uzadow
| Updated copyright.
|
| Revision 1.7 2001/10/16 17:12:26 uzadow
| Added support for resolution information (Luca Piergentili)
|
| Revision 1.6 2001/09/28 19:50:56 uzadow
| Added some 24 bpp stuff & other minor features.
|
| Revision 1.5 2001/09/24 14:18:42 uzadow
| Added operator -, improved const-correctness.
|
| Revision 1.4 2001/09/16 19:03:22 uzadow
| Added global name prefix PL, changed most filenames.
|
| Revision 1.3 2000/11/21 20:20:36 uzadow
| Changed bool to bool.
|
| Revision 1.2 2000/01/10 23:52:59 Ulrich von Zadow
| Changed formatting & removed tabs.
|
| Revision 1.1 1999/12/09 16:35:58 Ulrich von Zadow
| Added PLPoint.
|
|
\--------------------------------------------------------------------
*/
|