1 constexpr
inline ImageRef::ImageRef()
12 is.read((
char*)&x,
sizeof(
int));
13 is.read((
char*)&y,
sizeof(
int));
25 return(++x < max.x || (x=0, ++y < max.y) || (y=0,
false));
28 inline bool ImageRef::next(
const ImageRef& min,
const ImageRef& max)
30 return (++x < max.x || (x=min.x, ++y < max.y) || (y=min.y,
false));
35 return(--x > -1 || (x=max.x-1, --y > -1) || (y=max.y-1,
false));
38 inline bool ImageRef::prev(
const ImageRef& min,
const ImageRef& max)
40 return (--x > min.x-1 || (x=max.x-1, --y > min.y-1) || (y=max.y-1,
false));
63 return (x==ref.x && y==ref.y);
68 return (x!=ref.x || y!=ref.y);
107 ImageRef v((
int)(x*scale),(
int)(y*scale));
113 ImageRef v((
int)(x/scale),(
int)(y/scale));
119 ImageRef v(x+rhs.x, y+rhs.y);
125 ImageRef v(x-rhs.x, y-rhs.y);
170 constexpr
inline ImageRef operator*(
const int scale,
const ImageRef& ref)
172 return ImageRef(ref.x*scale, ref.y*scale);
177 return y < other.y || ( y == other.y && x < other.x);
182 return y > other.y || ( y == other.y && x > other.x);
193 throw Exceptions::BadSubscript();
203 throw Exceptions::BadSubscript();
208 typedef unsigned int uint;
209 return uint(x*x) + uint(y*y);
219 return ImageRef(x * ref.x, y * ref.y);
constexpr ImageRef operator/(const double scale) const
Divide both x and y co-ordinates by a scalar.
Definition: image_ref.h:112
constexpr ImageRef shiftl(int i) const
Definition: image_ref.h:144
constexpr ImageRef shiftr(int i) const
Definition: image_ref.h:152
constexpr int area() const
Area (product of x and y; signed)
Definition: image_ref.h:213
constexpr ImageRef & operator*=(const double scale)
Multiply both x and y co-ordinates by a scalar.
Definition: image_ref.h:78
constexpr ImageRef operator+(const ImageRef rhs) const
Add an offset to the co-ordinate.
Definition: image_ref.h:118
constexpr ImageRef()
Construct an ImageRef initialised at (0,0)
Definition: image_ref.h:2
constexpr bool operator>(const ImageRef &other) const
An ImageRef is greater than another ImageRef if it is earlier in the standard horizontal scan-line or...
Definition: image_ref.h:181
constexpr ImageRef & operator<<=(int i)
Bitwise left-shift operator.
Definition: image_ref.h:130
constexpr unsigned int mag_squared() const
Magnitude-squared (x*x + y*y)
Definition: image_ref.h:207
bool next(const ImageRef &max)
Step to the next co-ordinate in the image (in horizontal scanline order).
Definition: image_ref.h:24
constexpr ImageRef operator>>(int i) const
Bitwise right-shift operator.
Definition: image_ref.h:165
constexpr ImageRef operator*(const double scale) const
Multiply both x and y co-ordinates by a scalar.
Definition: image_ref.h:106
bool prev(const ImageRef &max)
Step to the previous co-ordinate in the image (in horizontal scanline order).
Definition: image_ref.h:34
constexpr ImageRef & operator>>=(int i)
Bitwise right-shift operator.
Definition: image_ref.h:137
constexpr ImageRef & operator=(const ImageRef &ref)
Assigment.
Definition: image_ref.h:55
constexpr ImageRef & operator+=(const ImageRef rhs)
Add an offset to the co-ordinate.
Definition: image_ref.h:92
int x
The x co-ordinate.
Definition: image_ref.h:172
constexpr ImageRef operator-() const
Unary minus. Negates both x and y components.
Definition: image_ref.h:72
constexpr bool operator<(const ImageRef &other) const
An ImageRef is less than another ImageRef if it is earlier in the standard horizontal scan-line order...
Definition: image_ref.h:176
constexpr bool operator!=(const ImageRef &ref) const
Logical not equals.
Definition: image_ref.h:67
void home()
Resets the ImageRef to (0,0)
Definition: image_ref.h:44
constexpr bool operator==(const ImageRef &ref) const
Logical equals.
Definition: image_ref.h:62
constexpr int & operator[](int i)
Square bracket subscripts for easy loops. 0=x 1=y other=error.
Definition: image_ref.h:187
void end(const ImageRef &size)
Resets the ImageRef to the maximum co-ordinate in the image i.e.
Definition: image_ref.h:49
constexpr ImageRef & operator-=(const ImageRef rhs)
Subtract an offset from the co-ordinate.
Definition: image_ref.h:99
constexpr ImageRef operator<<(int i) const
Bitwise left-shift operator.
Definition: image_ref.h:160
constexpr ImageRef dot_times(const ImageRef &ref) const
The equivalent of doing .* in matlab.
Definition: image_ref.h:218
constexpr ImageRef & operator/=(const double scale)
Divide both x and y co-ordinates by a scalar.
Definition: image_ref.h:85