axle OS
x86_32 UNIX-like hobby OS
src
gfx
lib
rect.h
1
#ifndef RECT_H
2
#define RECT_H
3
4
#include "point.h"
5
#include "size.h"
6
#include <std/array_m.h>
7
#include <stdbool.h>
8
9
#define rect_min_x(r) ((r).origin.x)
10
#define rect_min_y(r) ((r).origin.y)
11
#define rect_max_x(r) ((r).origin.x + (r).size.width)
12
#define rect_max_y(r) ((r).origin.y + (r).size.height)
13
14
typedef
struct
rect
{
15
Point
origin;
16
Size
size
;
17
}
Rect
;
18
19
Rect
rect_make(
Point
origin,
Size
size
);
20
Rect
rect_zero();
21
22
bool
rect_intersects(
Rect
A,
Rect
B);
23
24
//explode subject rect into array of contiguous rects which are
25
//not occluded by cutting rect
26
Rect
* rect_clip(
Rect
subject,
Rect
cutting);
27
28
//find the intersecting rect of a and b
29
Rect
rect_intersect(
Rect
a,
Rect
b);
30
//returns true if point is bounded by rect
31
bool
rect_contains_point(
Rect
r,
Point
p);
32
33
//convert inner to outer's coordinate space
34
Rect
convert_rect(
Rect
outer,
Rect
inner);
35
36
#endif
size
Definition:
size.h:4
coordinate
Definition:
point.h:4
rect
Definition:
rect.h:14
Generated by
1.8.14