Show a patch.

GET /api/1.1/patches/15936/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 15936,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15936/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15936/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20220517143325.71784-13-tomi.valkeinen@ideasonboard.com>",
    "date": "2022-05-17T14:33:24",
    "name": "[libcamera-devel,v2,12/13] py: add geometry classes",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ee50a073dd34970c6253f7cd4e3944a20d88e000",
    "submitter": {
        "id": 109,
        "url": "https://patchwork.libcamera.org/api/1.1/people/109/?format=api",
        "name": "Tomi Valkeinen",
        "email": "tomi.valkeinen@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15936/mbox/",
    "series": [
        {
            "id": 3116,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3116/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3116",
            "date": "2022-05-17T14:33:12",
            "name": "Misc Python bindings patches",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3116/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15936/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15936/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id AB43CC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 May 2022 14:34:04 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 25D5B65663;\n\tTue, 17 May 2022 16:34:04 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D314265676\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 May 2022 16:33:57 +0200 (CEST)",
            "from deskari.lan (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3E1B74A8;\n\tTue, 17 May 2022 16:33:57 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652798044;\n\tbh=lJxPhYu1Q9PAKcijXta3z7JGTZfAb86TDDJn4rPYuAQ=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=P2DaFzIKuhEUndxG6t97BD+wT/dw4zV8HigttWcqK7xMpwjAGUeNR6FHxt5hmRJgW\n\trWKS1X7IlCwrPS7OhDECh8VIZFnekmu4dENAUAJXQPyFMVfz3C4QteLH3gLT4y8yuL\n\tGsSvDqHKF88RE3CfnAXXiuqtKApngDh3ocYBijhmW7PjoiBVwQkWUsoB9klYrGn9S9\n\tdEZKjqlNgu1g1xRYprECqSo8qH417dsE7oDMacDVR8bH79aoCOxNBkpP6/34U64QXM\n\tQVttsuOO/a3rJ7AnNIa71zMoEJLfs4IfTDNHP+nveNp1479K5M/MlByr2h+GiQbJzF\n\tcrjU9jzNrNfTQ==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652798037;\n\tbh=lJxPhYu1Q9PAKcijXta3z7JGTZfAb86TDDJn4rPYuAQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=YD0WxpypdNVjfaWqdwkRE6lVbNCWD+r2AP0GDXf9Jhm1QTHWdMy7/UtMeV8y8DCBx\n\tbEuGn3IKuEB+PdjEaxV3rBYHysXZlQ8jtoFigS6PdM2KgoP2UPdnnKPSJBOCzoFPDo\n\tabu7S9hb/b9A2PfO8UZ9q4qNtGrpwItuc7fo7s6A="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"YD0Wxpyp\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tJacopo Mondi <jacopo@jmondi.org>",
        "Date": "Tue, 17 May 2022 17:33:24 +0300",
        "Message-Id": "<20220517143325.71784-13-tomi.valkeinen@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220517143325.71784-1-tomi.valkeinen@ideasonboard.com>",
        "References": "<20220517143325.71784-1-tomi.valkeinen@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 12/13] py: add geometry classes",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "From": "Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Add libcamera's geometry classes to the Python bindings.\n\nNote that this commit only adds the classes, but they are not used\nanywhere yet.\n\nSigned-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n---\n src/py/libcamera/meson.build    |   1 +\n src/py/libcamera/pygeometry.cpp | 119 ++++++++++++++++++++++++++++++++\n src/py/libcamera/pymain.cpp     |   2 +\n 3 files changed, 122 insertions(+)\n create mode 100644 src/py/libcamera/pygeometry.cpp",
    "diff": "diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build\nindex 32e74504..0bef52c7 100644\n--- a/src/py/libcamera/meson.build\n+++ b/src/py/libcamera/meson.build\n@@ -14,6 +14,7 @@ pybind11_dep = pybind11_proj.get_variable('pybind11_dep')\n \n pycamera_sources = files([\n     'pyenums.cpp',\n+    'pygeometry.cpp',\n     'pymain.cpp',\n ])\n \ndiff --git a/src/py/libcamera/pygeometry.cpp b/src/py/libcamera/pygeometry.cpp\nnew file mode 100644\nindex 00000000..d77de144\n--- /dev/null\n+++ b/src/py/libcamera/pygeometry.cpp\n@@ -0,0 +1,119 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n+ *\n+ * Python bindings - Geometry classes\n+ */\n+\n+#include <array>\n+\n+#include <libcamera/geometry.h>\n+#include <libcamera/libcamera.h>\n+\n+#include <pybind11/operators.h>\n+#include <pybind11/smart_holder.h>\n+#include <pybind11/stl.h>\n+\n+namespace py = pybind11;\n+\n+using namespace libcamera;\n+\n+void init_pygeometry(py::module &m)\n+{\n+\tauto pyPoint = py::class_<Point>(m, \"Point\");\n+\tauto pySize = py::class_<Size>(m, \"Size\");\n+\tauto pySizeRange = py::class_<SizeRange>(m, \"SizeRange\");\n+\tauto pyRectangle = py::class_<Rectangle>(m, \"Rectangle\");\n+\n+\tpyPoint\n+\t\t.def(py::init<>())\n+\t\t.def(py::init<int, int>())\n+\t\t.def_readwrite(\"x\", &Point::x)\n+\t\t.def_readwrite(\"y\", &Point::y)\n+\t\t.def(py::self == py::self)\n+\t\t.def(-py::self)\n+\t\t.def(\"__str__\", &Point::toString)\n+\t\t.def(\"__repr__\", [](const Point &self) {\n+\t\t\treturn py::str(\"libcamera.Point({}, {})\")\n+\t\t\t\t.format(self.x, self.y);\n+\t\t});\n+\n+\tpySize\n+\t\t.def(py::init<>())\n+\t\t.def(py::init<unsigned int, unsigned int>())\n+\t\t.def_readwrite(\"width\", &Size::width)\n+\t\t.def_readwrite(\"height\", &Size::height)\n+\t\t.def_property_readonly(\"is_null\", &Size::isNull)\n+\t\t.def(\"align_down_to\", &Size::alignDownTo)\n+\t\t.def(\"align_up_to\", &Size::alignUpTo)\n+\t\t.def(\"bound_to\", &Size::boundTo)\n+\t\t.def(\"expand_to\", &Size::expandTo)\n+\t\t.def(\"grow_by\", &Size::growBy)\n+\t\t.def(\"shrink_by\", &Size::shrinkBy)\n+\t\t.def(\"aligned_up_to\", &Size::alignedUpTo)\n+\t\t.def(\"aligned_up_to\", &Size::alignedUpTo)\n+\t\t.def(\"bounded_to\", &Size::boundedTo)\n+\t\t.def(\"expanded_to\", &Size::expandedTo)\n+\t\t.def(\"grown_by\", &Size::grownBy)\n+\t\t.def(\"shrunk_by\", &Size::shrunkBy)\n+\t\t.def(\"bounded_to_aspect_ratio\", &Size::boundedToAspectRatio)\n+\t\t.def(\"expanded_to_aspect_ratio\", &Size::expandedToAspectRatio)\n+\t\t.def(\"centered_to\", &Size::centeredTo)\n+\t\t.def(py::self == py::self)\n+\t\t.def(py::self < py::self)\n+\t\t.def(py::self <= py::self)\n+\t\t.def(py::self * float())\n+\t\t.def(py::self / float())\n+\t\t.def(py::self *= float())\n+\t\t.def(py::self /= float())\n+\t\t.def(\"__str__\", &Size::toString)\n+\t\t.def(\"__repr__\", [](const Size &self) {\n+\t\t\treturn py::str(\"libcamera.Size({}, {})\")\n+\t\t\t\t.format(self.width, self.height);\n+\t\t});\n+\n+\tpySizeRange\n+\t\t.def(py::init<>())\n+\t\t.def(py::init<Size>())\n+\t\t.def(py::init<Size, Size>())\n+\t\t.def(py::init<Size, Size, unsigned int, unsigned int>())\n+\t\t.def_readwrite(\"min\", &SizeRange::min)\n+\t\t.def_readwrite(\"max\", &SizeRange::max)\n+\t\t.def_readwrite(\"hStep\", &SizeRange::hStep)\n+\t\t.def_readwrite(\"vStep\", &SizeRange::vStep)\n+\t\t.def(\"contains\", &SizeRange::contains)\n+\t\t.def(py::self == py::self)\n+\t\t.def(\"__str__\", &SizeRange::toString)\n+\t\t.def(\"__repr__\", [](const SizeRange &self) {\n+\t\t\treturn py::str(\"libcamera.SizeRange(({}, {}), ({}, {}), {}, {})\")\n+\t\t\t\t.format(self.min.width, self.min.height,\n+\t\t\t\t\tself.max.width, self.max.height,\n+\t\t\t\t\tself.hStep, self.vStep);\n+\t\t});\n+\n+\tpyRectangle\n+\t\t.def(py::init<>())\n+\t\t.def(py::init<int, int, Size>())\n+\t\t.def(py::init<int, int, unsigned int, unsigned int>())\n+\t\t.def(py::init<Size>())\n+\t\t.def_readwrite(\"x\", &Rectangle::x)\n+\t\t.def_readwrite(\"y\", &Rectangle::y)\n+\t\t.def_readwrite(\"width\", &Rectangle::width)\n+\t\t.def_readwrite(\"height\", &Rectangle::height)\n+\t\t.def_property_readonly(\"is_null\", &Rectangle::isNull)\n+\t\t.def_property_readonly(\"center\", &Rectangle::center)\n+\t\t.def_property_readonly(\"size\", &Rectangle::size)\n+\t\t.def_property_readonly(\"topLeft\", &Rectangle::topLeft)\n+\t\t.def(\"scale_by\", &Rectangle::scaleBy)\n+\t\t.def(\"translate_by\", &Rectangle::translateBy)\n+\t\t.def(\"bounded_to\", &Rectangle::boundedTo)\n+\t\t.def(\"enclosed_in\", &Rectangle::enclosedIn)\n+\t\t.def(\"scaled_by\", &Rectangle::scaledBy)\n+\t\t.def(\"translated_by\", &Rectangle::translatedBy)\n+\t\t.def(py::self == py::self)\n+\t\t.def(\"__str__\", &Rectangle::toString)\n+\t\t.def(\"__repr__\", [](const Rectangle &self) {\n+\t\t\treturn py::str(\"libcamera.Rectangle({}, {}, {}, {})\")\n+\t\t\t\t.format(self.x, self.y, self.width, self.height);\n+\t\t});\n+}\ndiff --git a/src/py/libcamera/pymain.cpp b/src/py/libcamera/pymain.cpp\nindex 97b05903..96333ebc 100644\n--- a/src/py/libcamera/pymain.cpp\n+++ b/src/py/libcamera/pymain.cpp\n@@ -137,11 +137,13 @@ static void handleRequestCompleted(Request *req)\n \n void init_pyenums(py::module &m);\n void init_pyenums_generated(py::module &m);\n+void init_pygeometry(py::module &m);\n \n PYBIND11_MODULE(_libcamera, m)\n {\n \tinit_pyenums(m);\n \tinit_pyenums_generated(m);\n+\tinit_pygeometry(m);\n \n \t/* Forward declarations */\n \n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "12/13"
    ]
}