[libcamera-devel] [PATCH 2/3] libcamera: Add geometry.h

Niklas Söderlund niklas.soderlund at ragnatech.se
Tue Feb 5 19:35:31 CET 2019


Hi Jacopo,

Thanks for your patch.

On 2019-02-05 18:10:09 +0100, Jacopo Mondi wrote:
> Add geometry related definitions in the geometry.h internal header
> 
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
>  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

This is geometry.cpp right?

> + */
> +
> +#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

How about:

    Describe a rectangles dimensions and its 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

s/than contains one//

> + * 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',
> -- 
> 2.20.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list