From patchwork Wed Feb 6 06:08:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 526 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EFD926101F for ; Wed, 6 Feb 2019 07:08:25 +0100 (CET) Received: from pendragon.ideasonboard.com (d51A4137F.access.telenet.be [81.164.19.127]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9C4F341 for ; Wed, 6 Feb 2019 07:08:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1549433305; bh=Ecz3XcRZGXvyn6AFi52ZSkpjWh6Zs/6I0DMJ3zuS4lg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GCsql1FE2yay0tNY8aKXuOqqfj6YNkXWEESPwn4LnbOPzKQZASqA3AmhNebAwtxMR EhExYr/iSISvrNR0wV0Is/1kmbHAvsvdVzxz+0jKnq+RjVa6wrqap5ZS+DA53faYvN +UZ6bKygoBi4ug1rI/5WcspWPeuiSY3run2riyyY= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 6 Feb 2019 08:08:02 +0200 Message-Id: <20190206060818.13907-12-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190206060818.13907-1-laurent.pinchart@ideasonboard.com> References: <20190206060818.13907-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 11/27] libcamera: Add geometry.h X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2019 06:08:27 -0000 From: Jacopo Mondi Add geometry-related definitions in the geometry.h internal header. Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- src/libcamera/geometry.cpp | 49 ++++++++++++++++++++++++++++++++ src/libcamera/include/geometry.h | 22 ++++++++++++++ src/libcamera/meson.build | 1 + 3 files changed, 72 insertions(+) create mode 100644 src/libcamera/geometry.cpp create mode 100644 src/libcamera/include/geometry.h diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp new file mode 100644 index 000000000000..57f4fc7716d9 --- /dev/null +++ b/src/libcamera/geometry.cpp @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * geometry.cpp - Geometry-related structures + */ + +#include "geometry.h" + +/** + * \file geometry.h + * \brief Data structures related to geometric objects + */ + +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::w + * \brief The distance between the left and right sides + */ + +/** + * \var Rectangle::h + * \brief The distance between the top and bottom sides + */ + +} /* namespace libcamera */ diff --git a/src/libcamera/include/geometry.h b/src/libcamera/include/geometry.h new file mode 100644 index 000000000000..cc146da7cb0d --- /dev/null +++ b/src/libcamera/include/geometry.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * geometry.h - Geometry-related structure + */ + +#ifndef __LIBCAMERA_GEOMETRY_H__ +#define __LIBCAMERA_GEOMETRY_H__ + +namespace libcamera { + +struct Rectangle { + int x; + int y; + unsigned int w; + unsigned int h; +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_GEOMETRY_H__ */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index a4e9cc8f936c..8b33c4b25c30 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -6,6 +6,7 @@ libcamera_sources = files([ 'event_dispatcher.cpp', 'event_dispatcher_poll.cpp', 'event_notifier.cpp', + 'geometry.cpp', 'log.cpp', 'media_device.cpp', 'media_object.cpp',