From a20182310dc7d2ad56cf208269a05206580a9a94 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Fri, 22 Mar 2019 13:01:49 +0100 Subject: libcamera: geometry: Add toString to Rectangle Add toString() helpers to pretty print out the sizes of a Rectangle. Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/libcamera/geometry.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/libcamera/geometry.cpp') diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp index b6b6592b..6dc8e74d 100644 --- a/src/libcamera/geometry.cpp +++ b/src/libcamera/geometry.cpp @@ -5,6 +5,8 @@ * geometry.cpp - Geometry-related structures */ +#include + #include "geometry.h" /** @@ -46,6 +48,20 @@ namespace libcamera { * \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 << ")/" << w << "x" << h; + + return ss.str(); +} + /** * \struct SizeRange * \brief Describe a range of image sizes -- cgit v1.2.1