summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_quad.h
blob: 2a8b058bf41a5543ad4eac0d8c432ae6a9ec1d41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* EINA - EFL data type library
 * Copyright (C) 2007-2014 Jorge Luis Zapata
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.
 * If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef EINA_QUAD_H_
#define EINA_QUAD_H_

#include <eina_rectangle.h>

/**
 * @file
 * @ender_group{Eina_Quad}
 */

/**
 * @addtogroup Eina_Data_Types_Group Data Types
 *
 * @{
 */

/**
 * @defgroup Eina_Quad_Group Quadrangles
 *
 * @brief Quadrangles operations.
 *
 * @{
 */

/**
 * Quadrangle definition
 */
typedef struct _Eina_Quad
{
   double x0; /**< Top left x coordinate */
   double y0; /**< Top left y coordinate */
   double x1; /**< Top right x coordinate */
   double y1; /**< Top right y coordinate */
   double x2; /**< Bottom right x coordinate */
   double y2; /**< Bottom right y coordinate */
   double x3; /**< Bottom left x coordinate */
   double y3; /**< Bottom left y coordinate */
} Eina_Quad;

/**
 * @brief Transform the given quadrangle to the given rectangle.
 *
 * @param q The quadrangle to get coordinates.
 * @param r The rectangle.
 *
 * @since 1.14
 * */
EAPI void eina_quad_rectangle_to(const Eina_Quad *q,
                                 Eina_Rectangle *r);
/**
 * @brief Transform the given rectangle to the given quadrangle.
 *
 * @param q The quadrangle.
 * @param r The rectangle to get coordinates.
 *
 * @since 1.14
 * */
EAPI void eina_quad_rectangle_from(Eina_Quad *q,
                                   const Eina_Rectangle *r);
/**
 * @brief Sets the values of the coordinates of the given quadrangle.
 *
 * @param q The quadrangle to set coordinates.
 * @param x0 Top left x coordinate.
 * @param y0 Top left y coordinate.
 * @param x1 Top right x coordinate.
 * @param y1 Top right y coordinate.
 * @param x2 Bottom right x coordinate.
 * @param y2 Bottom right y coordinate.
 * @param x3 Bottom left x coordinate.
 * @param y3 Bottom left y coordinate.
 *
 * @since 1.14
 * */
EAPI void eina_quad_coords_set(Eina_Quad *q,
                               double x0, double y0,
                               double x1, double y1,
                               double x2, double y2,
                               double x3, double y3);

/**
 * @brief Gets the values of the coordinates of the given quadrangle.
 *
 * @param q The quadrangle to get coordinates.
 * @param x0 Top left x coordinate.
 * @param y0 Top left y coordinate.
 * @param x1 Top right x coordinate.
 * @param y1 Top right y coordinate.
 * @param x2 Bottom right x coordinate.
 * @param y2 Bottom right y coordinate.
 * @param x3 Bottom left x coordinate.
 * @param y3 Bottom left y coordinate.
 *
 * @since 1.14
 * */
EAPI void eina_quad_coords_get(const Eina_Quad *q,
                               double *x0, double *y0,
                               double *x1, double *y1,
                               double *x2, double *y2,
                               double *x3, double *y3);

/**
 * @}
 */

/**
 * @}
 */

#endif