diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-20 19:29:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-20 19:29:02 +0400 |
commit | 26f073b327ac31d683e1719ce8371b6e28bf01d6 (patch) | |
tree | fecb4fdc3f279436ab3814e60266633ba02de50a /source/blender/blenlib/BLI_rect.h | |
parent | 831eaf2d7feb63ee6df55a2b00e1d76f793c0a5c (diff) |
macros for rectangle center and size
Diffstat (limited to 'source/blender/blenlib/BLI_rect.h')
-rw-r--r-- | source/blender/blenlib/BLI_rect.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h index d6579afcd0d..43639b141e1 100644 --- a/source/blender/blenlib/BLI_rect.h +++ b/source/blender/blenlib/BLI_rect.h @@ -75,6 +75,15 @@ void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src); void print_rctf(const char *str, const struct rctf *rect); void print_rcti(const char *str, const struct rcti *rect); +#define BLI_RCT_SIZE_X(rct) ((rct)->xmax - (rct)->xmin) +#define BLI_RCT_SIZE_Y(rct) ((rct)->ymax - (rct)->ymin) + +#define BLI_RCT_CENTER_X(rct) (((rct)->xmin + (rct)->xmax) / 2) +#define BLI_RCT_CENTER_Y(rct) (((rct)->ymin + (rct)->ymax) / 2) + +#define BLI_RCT_CENTER_X_FL(rct) ((float)((rct)->xmin + (rct)->xmax) / 2.0f) +#define BLI_RCT_CENTER_Y_FL(rct) ((float)((rct)->ymin + (rct)->ymax) / 2.0f) + #ifdef __cplusplus } #endif |