diff options
-rw-r--r-- | include/libcamera/geometry.h | 30 | ||||
-rw-r--r-- | src/libcamera/geometry.cpp | 122 |
2 files changed, 76 insertions, 76 deletions
diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h index d217cfd5..f3088d33 100644 --- a/include/libcamera/geometry.h +++ b/include/libcamera/geometry.h @@ -13,21 +13,6 @@ namespace libcamera { -struct Rectangle { - int x; - int y; - unsigned int width; - unsigned int height; - - const std::string toString() const; -}; - -bool operator==(const Rectangle &lhs, const Rectangle &rhs); -static inline bool operator!=(const Rectangle &lhs, const Rectangle &rhs) -{ - return !(lhs == rhs); -} - struct Size { Size() : Size(0, 0) @@ -141,6 +126,21 @@ static inline bool operator!=(const SizeRange &lhs, const SizeRange &rhs) return !(lhs == rhs); } +struct Rectangle { + int x; + int y; + unsigned int width; + unsigned int height; + + const std::string toString() const; +}; + +bool operator==(const Rectangle &lhs, const Rectangle &rhs); +static inline bool operator!=(const Rectangle &lhs, const Rectangle &rhs) +{ + return !(lhs == rhs); +} + } /* namespace libcamera */ #endif /* __LIBCAMERA_GEOMETRY_H__ */ diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp index 4594f9ff..5a0bcf7c 100644 --- a/src/libcamera/geometry.cpp +++ b/src/libcamera/geometry.cpp @@ -18,67 +18,6 @@ namespace libcamera { /** - * \struct Rectangle - * \brief Describe a rectangle's position and dimensions - * - * Rectangles are used to identify an area of an image. They are specified by - * the coordinates of top-left corner and their horizontal and vertical size. - * - * The measure unit of the rectangle coordinates and size, as well as the - * reference point from which the Rectangle::x and Rectangle::y displacements - * refers to, are defined by the context were rectangle is used. - */ - -/** - * \var Rectangle::x - * \brief The horizontal coordinate of the rectangle's top-left corner - */ - -/** - * \var Rectangle::y - * \brief The vertical coordinate of the rectangle's top-left corner - */ - -/** - * \var Rectangle::width - * \brief The distance between the left and right sides - */ - -/** - * \var Rectangle::height - * \brief The distance between the top and bottom sides - */ - -/** - * \brief Assemble and return a string describing the rectangle - * \return A string describing the Rectangle - */ -const std::string Rectangle::toString() const -{ - std::stringstream ss; - - ss << "(" << x << "x" << y << ")/" << width << "x" << height; - - return ss.str(); -} - -/** - * \brief Compare rectangles for equality - * \return True if the two rectangles are equal, false otherwise - */ -bool operator==(const Rectangle &lhs, const Rectangle &rhs) -{ - return lhs.x == rhs.x && lhs.y == rhs.y && - lhs.width == rhs.width && lhs.height == rhs.height; -} - -/** - * \fn bool operator!=(const Rectangle &lhs, const Rectangle &rhs) - * \brief Compare rectangles for inequality - * \return True if the two rectangles are not equal, false otherwise - */ - -/** * \struct Size * \brief Describe a two-dimensional size * @@ -346,4 +285,65 @@ bool operator==(const SizeRange &lhs, const SizeRange &rhs) * \return True if the two size ranges are not equal, false otherwise */ +/** + * \struct Rectangle + * \brief Describe a rectangle's position and dimensions + * + * Rectangles are used to identify an area of an image. They are specified by + * the coordinates of top-left corner and their horizontal and vertical size. + * + * The measure unit of the rectangle coordinates and size, as well as the + * reference point from which the Rectangle::x and Rectangle::y displacements + * refers to, are defined by the context were rectangle is used. + */ + +/** + * \var Rectangle::x + * \brief The horizontal coordinate of the rectangle's top-left corner + */ + +/** + * \var Rectangle::y + * \brief The vertical coordinate of the rectangle's top-left corner + */ + +/** + * \var Rectangle::width + * \brief The distance between the left and right sides + */ + +/** + * \var Rectangle::height + * \brief The distance between the top and bottom sides + */ + +/** + * \brief Assemble and return a string describing the rectangle + * \return A string describing the Rectangle + */ +const std::string Rectangle::toString() const +{ + std::stringstream ss; + + ss << "(" << x << "x" << y << ")/" << width << "x" << height; + + return ss.str(); +} + +/** + * \brief Compare rectangles for equality + * \return True if the two rectangles are equal, false otherwise + */ +bool operator==(const Rectangle &lhs, const Rectangle &rhs) +{ + return lhs.x == rhs.x && lhs.y == rhs.y && + lhs.width == rhs.width && lhs.height == rhs.height; +} + +/** + * \fn bool operator!=(const Rectangle &lhs, const Rectangle &rhs) + * \brief Compare rectangles for inequality + * \return True if the two rectangles are not equal, false otherwise + */ + } /* namespace libcamera */ |