From patchwork Tue Feb 5 17:10:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 513 Return-Path: Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0CA0A60DBF for ; Tue, 5 Feb 2019 18:10:00 +0100 (CET) X-Originating-IP: 81.164.19.127 Received: from uno.localdomain (d51A4137F.access.telenet.be [81.164.19.127]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id B127A240010; Tue, 5 Feb 2019 17:09:59 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Feb 2019 18:10:09 +0100 Message-Id: <20190205171010.1356-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190205171010.1356-1-jacopo@jmondi.org> References: <20190205171010.1356-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/3] 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: Tue, 05 Feb 2019 17:10:00 -0000 Add geometry related definitions in the geometry.h internal header Signed-off-by: Jacopo Mondi --- src/libcamera/geometry.cpp | 52 ++++++++++++++++++++++++++++++++ src/libcamera/include/geometry.h | 23 ++++++++++++++ src/libcamera/meson.build | 1 + 3 files changed, 76 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 0000000..2cc67e8 --- /dev/null +++ b/src/libcamera/geometry.cpp @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * geometry.h - Geometry-related structures + */ + +#include "geometry.h" + +/** + * \file geometry.h + * \brief Structures and data related to geometric objects + */ + +namespace libcamera { + +/** + * \struct Rectangle + * \brief Defines a rectangle sizes and position + * + * Rectangles are used to identify an area of an image, or of a memory area + * than contains one. Their location is identified by the coordinates of their + * leftmost and topmost corner, and their horizontal and vertical length. + * + * The measure unit of the rectangle sizes is defined by the context where the + * rectangle is used. + * + * The reference point from which the Rectangle::x and Rectangle::y + * displacements refers to is defined by the context were rectangle is used. + */ + +/** + * \var Rectangle::x + * \brief The horizontal displacement of the rectangle's leftmost corner + */ + +/** + * \var Rectangle::y + * \brief The vertical displacement of the rectangle's topmost corner + */ + +/** + * \var Rectangle::w + * \brief The distance between the leftmost and rightmost corners + */ + +/** + * \var Rectangle::h + * \brief The distance between the topmost and bottommost corners + */ + +} /* namespace libcamera */ diff --git a/src/libcamera/include/geometry.h b/src/libcamera/include/geometry.h new file mode 100644 index 0000000..b147c9a --- /dev/null +++ b/src/libcamera/include/geometry.h @@ -0,0 +1,23 @@ +/* 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 9f6ff99..3d6df2d 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -5,6 +5,7 @@ libcamera_sources = files([ 'event_dispatcher.cpp', 'event_dispatcher_poll.cpp', 'event_notifier.cpp', + 'geometry.cpp', 'log.cpp', 'media_device.cpp', 'media_object.cpp',