10 template<
typename _Tp>
class Rect_;
11 typedef Rect_<int> Rect;
18 Rect() : x(0), y(0), width(0), height(0){}
19 Rect(int32_t _x, int32_t _y, int32_t _width, int32_t _height) {
25 Rect(
const Rect& r) =
default;
26 Rect(Rect&& r)
noexcept {
31 r.x = r.y = r.width = r.height = 0;
33 Rect(
const cv::Rect& cvRect);
35 Rect& operator = (
const Rect& r) =
default;
36 Rect& operator = (Rect&& r)
noexcept {
41 r.x = r.y = r.width = r.height = 0;
44 Rect& operator = (
const cv::Rect& cvRect);
45 operator cv::Rect()
const;
47 return { width, height };
49 int32_t area()
const {
50 return width * height;
53 return width <= 0 || height <= 0;
55 friend std::ostream& operator<<(std::ostream& os,
const Rect& rect) {
56 os <<
"Rect (x: " << rect.x <<
", y: " << rect.y <<
", width: " << rect.width <<
", height: " << rect.height <<
")";
59 friend bool operator==(
const Rect& lhs,
const Rect& rhs) {
60 return lhs.x == rhs.x && lhs.y == rhs.y && lhs.width == rhs.width && lhs.height == rhs.height;
63 return x >= 0 && y >= 0 && width > 0 && height > 0;
73#if defined(SLIDEIO_INTERNAL_HEADER)
Definition: exceptions.hpp:15