Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/BLI_rect.h')
-rw-r--r--source/blender/blenlib/BLI_rect.h9
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