]> git.decadent.org.uk Git - ion3.git/blob - ioncore/rectangle.h
701d2b22be5d343da6dd00ed69456ea3fd48c873
[ion3.git] / ioncore / rectangle.h
1 /*
2  * ion/ioncore/rectangle.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2007. 
5  *
6  * Ion is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or
9  * (at your option) any later version.
10  */
11
12 #ifndef ION_IONCORE_RECTANGLE_H
13 #define ION_IONCORE_RECTANGLE_H
14
15 #include <stdio.h>
16 #include "common.h"
17 #include <libextl/extl.h>
18
19 INTRSTRUCT(WRectangle);
20
21 DECLSTRUCT(WRectangle){
22     int x, y;
23     int w, h;
24 };
25
26 #define RECTANGLE_SAME   0x00
27 #define RECTANGLE_X_DIFF 0x01
28 #define RECTANGLE_Y_DIFF 0x02
29 #define RECTANGLE_POS_DIFF (RECTANGLE_X_DIFF|RECTANGLE_Y_DIFF)
30 #define RECTANGLE_W_DIFF 0x04
31 #define RECTANGLE_H_DIFF 0x08
32 #define RECTANGLE_SZ_DIFF (RECTANGLE_W_DIFF|RECTANGLE_H_DIFF)
33
34 extern int rectangle_compare(const WRectangle *g, const WRectangle *h);
35 extern bool rectangle_contains(const WRectangle *g, int x, int y);
36 extern void rectangle_constrain(WRectangle *g, const WRectangle *bounds);
37
38 extern void rectange_debugprint(const WRectangle *g, const char *n);
39
40 #endif /* ION_IONCORE_RECTANGLE_H */
41