Generated by Doxygen 1.8.14
Neographics
rect.h
1
#pragma once
2
#ifdef NGFX_IS_CORE
3
#include <stdint.h>
4
#else
5
#include <pebble.h>
6
#endif
7
#include "point.h"
8
#include "size.h"
9
10
/*-----------------------------------------------------------------------------.
11
| |
12
| Rect |
13
| |
14
`-----------------------------------------------------------------------------*/
15
22
typedef
struct
n_GRect
{
23
n_GPoint
origin;
24
n_GSize
size;
25
}
n_GRect
;
26
30
#define n_GRect(x, y, w, h) ((n_GRect) {{x, y}, {w, h}})
31
37
#define n_grect_standardize(a) \
38
((a).size.w >= 0 \
39
? (a).size.h >= 0 \
40
/* normal */
\
41
? (n_GRect) { { (a).origin.x, (a).origin.y }, \
42
{ (a).size.w, (a).size.h }} \
43
/* switch vertically */
\
44
: (n_GRect) { { (a).origin.x, (a).origin.y + (a).size.h - 1 }, \
45
{ (a).size.w, -(a).size.h + 2 }} \
46
: (a).size.h >= 0 \
47
/* switch horizontally */
\
48
? (n_GRect) { { (a).origin.x + (a).size.w - 1, (a).origin.y }, \
49
{ -(a).size.w + 2, (a).size.h }} \
50
/* switch horizontally and vertically */
\
51
: (n_GRect) { { (a).origin.x + (a).size.w - 1, (a).origin.y + (a).size.h - 1 }, \
52
{ -(a).size.w + 2, -(a).size.h + 2 }})
53
58
n_GPoint
n_grect_center_point
(
n_GRect
*rect);
59
n_GRect
#define n_GRect(x, y, w, h)
Definition:
rect.h:30
n_GRect
Definition:
rect.h:22
n_GPoint
Definition:
point.h:24
n_GSize
Definition:
size.h:22
n_grect_center_point
n_GPoint n_grect_center_point(n_GRect *rect)
Definition:
rect.c:3