From patchwork Tue Mar 22 20:57:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Rauch X-Patchwork-Id: 15513 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 63F1AC0F1B for ; Tue, 22 Mar 2022 20:57:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A6A40604DB; Tue, 22 Mar 2022 21:57:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1647982632; bh=Qla7VgVVy6GKHEfCI9eb+yezFVtD0w5n84XpAUtfCLI=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=QytHTj7LzzPpNXyNMipbJQYL2qrZFf/N277TOw0J4IeZqwQ7todkBY7bxRYQgFgQZ srs8rZoSjkcWOXBt96sKQtxfK1Se8TZUHWaTWBO4yzRhgJkFOb7tdedRCwBg6HvtJL KH7WSqa2Y3hjobUMLFigIRqVQVtCGIE2/WF8etMlJHRumUPd/KBeMwU9B5xmWg9flu vTPKdenP6/jFOSvskTvTVYQ0Jh9/TUCt88/s3TRHe74VdxcaVtpZenkvN2wt5BhGvN d4aqizU1Ia+ZX+opHlm9w7tKXd2uzR7qguvIoFoRU+0gHzlsuIGiVoNRK71spl6ERA pIGzhUTQFMqNQ== Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DB541604C5 for ; Tue, 22 Mar 2022 21:57:10 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=gmx.net header.i=@gmx.net header.b="QqB6nclz"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1647982630; bh=Qla7VgVVy6GKHEfCI9eb+yezFVtD0w5n84XpAUtfCLI=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=QqB6nclzl+6/8wbF9ngeUXFswBqEH6Ad9s5ckNvyjGsGTVFTKimbo14b7NlFNZNgM livPS7uUSAY6FdyNmiaHWB6CK643GsDk5JRL09YI5vKCfH8X8j34WasCiiiIZzwZ4f l6WrcCOMfTXRDYiLYkt0nUShqckyMJleoN3llzt8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([92.10.251.63]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M6lpM-1nQhIG1bEk-008FVa; Tue, 22 Mar 2022 21:57:10 +0100 To: libcamera-devel@lists.libcamera.org Date: Tue, 22 Mar 2022 20:57:08 +0000 Message-Id: <20220322205708.734021-1-Rauch.Christian@gmx.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:3tbl3wNpI7a6GIfYCkaZL4fjRXzozoF9Pt2Xsyo8yY7uj9eMNRR JHK8L/EwZjeXZ9cc0gLc410CIjdaPswcoyJTj3soQiuiLoSXlXT0EazY65YfinWyBtW08dl 62MdXMxooLxOIElahCP4xI8/UKuTLv8WKOX3mZCkld5ezQSnOvsIs2THBdltzOJYnZxzJbg nyWvX5UKmw725HByG8+ng== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:BdqIN55slqo=:PvujNGmNcg8kugirp4cJ8U fX0QOngW/53O8AkS/xXX+w6+Sjnub81AtGFiqCzPsFWiokNioOCIWtOXWkbAqzhC194ojuHwC /oqpxyolz08+88kmiozvaCK0CmQuGNh+UveduBhxDgRYXyo0sHx176NrdHv5BbKNnQT6VF2xt aQPUf/j/q1hfYL9/+DlYwxhDGeMySCV3LKHPc0O9xW1KwKK6R9g84+jTgvewNQmh2GptyQQpx BRDcK+R05EEe5ZpnHX06jkzHBTdfjj5IqNeh7zS4jOM6/kCAWLf+G3/rp1wkXWplY3eDYUPW7 Tdgs5uBozNZSyMRLTNFo8nv3zEzojrtVvhWvi28Vb6aLQi26EBXjC5iniDun8m6TFAoNEEp02 LWDBe9lvCd6m6K5C5uVDqmkFUWtK0i9YEdqfqyD4jXtH8JkcxND/I1x1JWrQCEkY8qneBYTWb fIHXWkVvWNi6wDBV/RoUrEYuAvOpv6SqYSZJgoMeD3NBEbYzWDG6LBYmjobw90i+CX0ouBLri BTvJnxfVC3/8UhcriL98HSDicUZ2J3HNJXH+V9YUBBBGnKPTsySkIzTXke+Vfu/Q02UWQMnP6 +Z2hh7jYt7S1ON5JlVZ/lY+5Vavi8mdOqfazFCz2052aX9fQ/k0T43rNb6yjxyqHSmc4BE//5 AKtt9Nw6zz9OqXPsXKFx3+oRsTHdwfqL1R3tihUO1iDpdrygpzg/wEEdbObaRy/zStBtnfrtH jPK1SGXSvQJyljMzAmNJXdNFYt4CbgEeoxLWbZIOuactpM4/NnDF91NvGX/1CFPyJ8mLEFOPH RZZgqLoj8PJdLoTocJC2Vjv0jskONjZKpPYmw5UXFUFZsM5t3J27XIE/Hu8gEbcEQ2lFTLGUa ECitLSb82NmNvGdf7z59pLT6dKpGE6IN3Y4F3dae+9C+UvioIjBIPs6BhHDTMuR5blXBEIfXi lILujNZ2vKPxt9cjSoRPNx5+f5+4ZvGaR4ivehMQrm+F7P7V83x7p1tfMz8Jv7JPnMBQA2lAd SVkv3sdAwb4HPHoZhudxLNv5xEmvT0GiMp8IP05r3VH/sJ62O3JWT1NcQZW8XqnoY+0jXue1X jKb8PNTeAuJTNA= Subject: [libcamera-devel] [PATCH] implement vector casts for Point, Size and Rectangle X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Christian Rauch via libcamera-devel From: Christian Rauch Reply-To: Christian Rauch Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Cast operators from Point, Size and Rectangle to std::vector allows to serialise those types without dedicated conversion functions. --- include/libcamera/geometry.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.25.1 diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h index 7838b679..7d1e403a 100644 --- a/include/libcamera/geometry.h +++ b/include/libcamera/geometry.h @@ -38,6 +38,11 @@ public: { return { -x, -y }; } + + operator std::vector() const + { + return { x, y }; + } }; bool operator==(const Point &lhs, const Point &rhs); @@ -167,6 +172,11 @@ public: Size &operator*=(float factor); Size &operator/=(float factor); + + operator std::vector() const + { + return { static_cast(width), static_cast(height) }; + } }; bool operator==(const Size &lhs, const Size &rhs); @@ -283,6 +293,11 @@ public: __nodiscard Rectangle scaledBy(const Size &numerator, const Size &denominator) const; __nodiscard Rectangle translatedBy(const Point &point) const; + + operator std::vector() const + { + return { x, y, static_cast(width), static_cast(height) }; + } }; bool operator==(const Rectangle &lhs, const Rectangle &rhs);