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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-08-27 00:23:26 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-08-27 00:23:26 +0400
commit03dbae07d346dcfb5cdaeeeea3585f642cd90d31 (patch)
tree866db44539cf778c636cd774f524970d434c77d3 /source/blender/editors/interface/view2d.c
parent11aa7a76fab53809f891ab8ff7898a2dd70005b8 (diff)
Mask primitives
Currently only circle and square, might be easily extended in the future. New primitives are creating at cursor location. This also implied adding 2d cursor to space clip. Also fix set 2D cursor location which didn't work in image editor's mask mode since 2.67. TODO: draw_image_cursor better be moved to some more generic file, but it's not so much important for now and might be solved later. Thanks Campbell for the review!
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r--source/blender/editors/interface/view2d.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index f656d22fc64..037fa7c6a94 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -2029,6 +2029,17 @@ void UI_view2d_to_region_no_clip(View2D *v2d, float x, float y, int *regionx, in
}
}
+void UI_view2d_to_region_float(View2D *v2d, float x, float y, float *regionx, float *regiony)
+{
+ /* express given coordinates as proportional values */
+ x = -v2d->cur.xmin / BLI_rctf_size_x(&v2d->cur);
+ y = -v2d->cur.ymin / BLI_rctf_size_y(&v2d->cur);
+
+ /* convert proportional distances to screen coordinates */
+ *regionx = v2d->mask.xmin + x * BLI_rcti_size_x(&v2d->mask);
+ *regiony = v2d->mask.ymin + y * BLI_rcti_size_y(&v2d->mask);
+}
+
/* *********************************************************************** */
/* Utilities */