21 #ifndef __CANVAS_TYPES_H__
22 #define __CANVAS_TYPES_H__
28 #include <boost/optional.hpp>
30 #include <cairomm/refptr.h>
88 Duple operator- ()
const throw () {
89 return Duple (-x, -y);
95 return x == o.x && y == o.y;
97 bool operator!= (
Duple const & o)
const throw () {
98 return x != o.x || y != o.y;
101 return Duple (x - o.x, y - o.y);
103 Duple operator/ (
double b)
const throw () {
104 return Duple (x / b, y / b);
133 Rect i (std::max (x0, o.x0), std::max (y0, o.y0),
134 std::min (x1, o.x1), std::min (y1, o.y1));
144 return Rect (std::min (x0, o.x0), std::min (y0, o.y0),
145 std::max (x1, o.x1), std::max (y1, o.y1));
152 return Rect (x0 - amount, y0 - amount,
157 return Rect (x0 - left, y0 - top,
168 x1 - amount, y1 - amount);
177 x1 - right, y1 - bottom);
181 return point.x >= x0 && point.x < x1 && point.y >= y0 && point.y < y1;
184 return Rect (std::min (x0, x1), std::min (y0, y1),
185 std::max (x0, x1), std::max (y0, y1));
188 bool empty()
const throw () {
return (x0 == x1 && y0 == y1); }
189 operator bool()
const throw () {
return !empty(); }
198 bool operator!= (
Rect const & o)
const throw () {
233 if (r >= 0) { args[1] = r; ++nargs; }
234 if (d >= 0) { args[2] = d; ++nargs; }
235 if (l >= 0) { args[3] = l; ++nargs; }
std::ostream & operator<<(std::ostream &, const ArdourCanvas::Item &)
Coord canvas_safe_add(Coord a, Coord b)
std::vector< Duple > Points
bool operator==(const ProcessorSelection &a, const ProcessorSelection &b)
Duple translate(const Duple &t) const
Duple(Coord x_, Coord y_)
FourDimensions(Distance u, Distance r=-1., Distance d=-1., Distance l=-1.)
Rect intersection(Rect const &o) const
Rect shrink(Distance amount) const
Rect extend(Rect const &o) const
Rect(Coord x0_, Coord y0_, Coord x1_, Coord y1_)
Rect translate(Duple const &t) const
Rect expand(Distance top, Distance right, Distance bottom, Distance left) const
Rect expand(Distance amount) const
bool contains(Duple const &point) const
Rect shrink(Distance top, Distance right, Distance bottom, Distance left) const