Show a patch.

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

{
    "id": 15792,
    "url": "https://patchwork.libcamera.org/api/patches/15792/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15792/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20220505104104.70841-10-tomi.valkeinen@ideasonboard.com>",
    "date": "2022-05-05T10:41:00",
    "name": "[libcamera-devel,v7,09/13] py: add Transform",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ef01c03af7d32f384efa0a3163e466728e5b6625",
    "submitter": {
        "id": 109,
        "url": "https://patchwork.libcamera.org/api/people/109/?format=api",
        "name": "Tomi Valkeinen",
        "email": "tomi.valkeinen@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15792/mbox/",
    "series": [
        {
            "id": 3093,
            "url": "https://patchwork.libcamera.org/api/series/3093/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3093",
            "date": "2022-05-05T10:40:51",
            "name": "Python bindings",
            "version": 7,
            "mbox": "https://patchwork.libcamera.org/series/3093/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15792/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15792/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 60A4DC326F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 May 2022 10:41:37 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A94866566B;\n\tThu,  5 May 2022 12:41:35 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 761AA65657\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 May 2022 12:41:30 +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 DD83AA46;\n\tThu,  5 May 2022 12:41:29 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1651747295;\n\tbh=kKxfsicKBd8oRUdODrs8kZ8BAB5F+y6fI6wvRUvLZxY=;\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=ncYFJtR6VWSK9s6aj2R1sJtsVpuy92aQ220g9u68X/115FBvU2VZ6V1xcJrypiuRS\n\tKYl7t28WYfQl5E2XEIW1qaNERvVg19jEkM79XwGN+E8gaXoaYqZNYXCpVvlXTOUMiW\n\twkCrTIb1Guu9Ut+8gbyLkoMhN7XqmcrhUiudH59T+YOlzKYTkHoJbTKtN+blrSLYR3\n\tScIPbiKpSyuNTG9wTLWgz6D9aAexFcqsxB0lcj4+0OdXYNyMl94oMgNfawj4JVnxZn\n\tf1Dii4zVFEoBx4pkZ7jHADMzk5gWwSv1/ii1wifR28oQrJkAwpJ2QS6772+0lhF2st\n\ti/t8FGa9U/QnQ==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1651747290;\n\tbh=kKxfsicKBd8oRUdODrs8kZ8BAB5F+y6fI6wvRUvLZxY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=g0xaLdyH75SS15qLVvlVqsR7ZWJjhqm1cq+18TrJrweJqbb9KGqIqn1SrGN4Qkt10\n\ttiS3NeSDGVrul3JZFbFZKXaNHE1PM/Kw/v82t7NMYxf71l/oDMQrxo+152Quc6veY8\n\tisMcL4Ox84KHrAlVwVP0uIF5uhD5eeA+GQGRhnng="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"g0xaLdyH\"; 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": "Thu,  5 May 2022 13:41:00 +0300",
        "Message-Id": "<20220505104104.70841-10-tomi.valkeinen@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220505104104.70841-1-tomi.valkeinen@ideasonboard.com>",
        "References": "<20220505104104.70841-1-tomi.valkeinen@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v7 09/13] py: add Transform",
        "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 binding for Transform.\n\nC++'s Transform is an enum class, but we expose it as a Python class so\nthat it can be easily manipulated.\n\nOriginal version from David Plowman <david.plowman@raspberrypi.com>.\n\nSigned-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n---\n src/py/libcamera/pymain.cpp | 63 ++++++++++++++++++++++++++++++++++++-\n 1 file changed, 62 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/py/libcamera/pymain.cpp b/src/py/libcamera/pymain.cpp\nindex db9d90ab..3d2393ab 100644\n--- a/src/py/libcamera/pymain.cpp\n+++ b/src/py/libcamera/pymain.cpp\n@@ -152,6 +152,7 @@ PYBIND11_MODULE(_libcamera, m)\n \tauto pyControlId = py::class_<ControlId>(m, \"ControlId\");\n \tauto pyRequest = py::class_<Request>(m, \"Request\");\n \tauto pyFrameMetadata = py::class_<FrameMetadata>(m, \"FrameMetadata\");\n+\tauto pyTransform = py::class_<Transform>(m, \"Transform\");\n \n \t/* Global functions */\n \tm.def(\"logSetLevel\", &logSetLevel);\n@@ -342,7 +343,8 @@ PYBIND11_MODULE(_libcamera, m)\n \t\t.def(\"validate\", &CameraConfiguration::validate)\n \t\t.def(\"at\", py::overload_cast<unsigned int>(&CameraConfiguration::at), py::return_value_policy::reference_internal)\n \t\t.def_property_readonly(\"size\", &CameraConfiguration::size)\n-\t\t.def_property_readonly(\"empty\", &CameraConfiguration::empty);\n+\t\t.def_property_readonly(\"empty\", &CameraConfiguration::empty)\n+\t\t.def_readwrite(\"transform\", &CameraConfiguration::transform);\n \n \tpyStreamConfiguration\n \t\t.def(\"toString\", &StreamConfiguration::toString)\n@@ -462,4 +464,63 @@ PYBIND11_MODULE(_libcamera, m)\n \t\t\ttransform(self.planes().begin(), self.planes().end(), v.begin(), [](const auto &p) { return p.bytesused; });\n \t\t\treturn v;\n \t\t});\n+\n+\tpyTransform\n+\t\t.def(py::init([](int rotation, bool hflip, bool vflip, bool transpose) {\n+\t\t\tbool ok;\n+\n+\t\t\tTransform t = transformFromRotation(rotation, &ok);\n+\t\t\tif (!ok)\n+\t\t\t\tthrow std::runtime_error(\"Unable to create the transform\");\n+\n+\t\t\tif (hflip)\n+\t\t\t\tt ^= Transform::HFlip;\n+\t\t\tif (vflip)\n+\t\t\t\tt ^= Transform::VFlip;\n+\t\t\tif (transpose)\n+\t\t\t\tt ^= Transform::Transpose;\n+\t\t\treturn t;\n+\t\t}), py::arg(\"rotation\") = 0, py::arg(\"hflip\") = false,\n+\t\t    py::arg(\"vflip\") = false, py::arg(\"transpose\") = false)\n+\t\t.def(py::init([](Transform &other) { return other; }))\n+\t\t.def(\"__repr__\", [](Transform &self) {\n+\t\t\treturn \"<libcamera.Transform '\" + std::string(transformToString(self)) + \"'>\";\n+\t\t})\n+\t\t.def_property(\"hflip\",\n+\t\t\t      [](Transform &self) {\n+\t\t\t\t      return !!(self & Transform::HFlip);\n+\t\t\t      },\n+\t\t\t      [](Transform &self, bool hflip) {\n+\t\t\t\t      if (hflip)\n+\t\t\t\t\t      self |= Transform::HFlip;\n+\t\t\t\t      else\n+\t\t\t\t\t      self &= ~Transform::HFlip;\n+\t\t\t      })\n+\t\t.def_property(\"vflip\",\n+\t\t\t      [](Transform &self) {\n+\t\t\t\t      return !!(self & Transform::VFlip);\n+\t\t\t      },\n+\t\t\t      [](Transform &self, bool vflip) {\n+\t\t\t\t      if (vflip)\n+\t\t\t\t\t      self |= Transform::VFlip;\n+\t\t\t\t      else\n+\t\t\t\t\t      self &= ~Transform::VFlip;\n+\t\t\t      })\n+\t\t.def_property(\"transpose\",\n+\t\t\t      [](Transform &self) {\n+\t\t\t\t      return !!(self & Transform::Transpose);\n+\t\t\t      },\n+\t\t\t      [](Transform &self, bool transpose) {\n+\t\t\t\t      if (transpose)\n+\t\t\t\t\t      self |= Transform::Transpose;\n+\t\t\t\t      else\n+\t\t\t\t\t      self &= ~Transform::Transpose;\n+\t\t\t      })\n+\t\t.def(\"inverse\", [](Transform &self) { return -self; })\n+\t\t.def(\"invert\", [](Transform &self) {\n+\t\t\tself = -self;\n+\t\t})\n+\t\t.def(\"compose\", [](Transform &self, Transform &other) {\n+\t\t\tself = self * other;\n+\t\t});\n }\n",
    "prefixes": [
        "libcamera-devel",
        "v7",
        "09/13"
    ]
}