diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-26 00:39:49 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-26 00:39:49 +0400 |
commit | 2b133b14ab1b37f80f94a7a411ee116e095c9b8d (patch) | |
tree | f5651e0b9d13fe68946e0362a69083bd14f3f5f4 /source/blender/editors/space_image/image_edit.c | |
parent | 8ad3e7396597ffcf56f3ad74c00dfc6fdcd504df (diff) |
mask/image viewer now works with non 1:1 image aspect, editing masks in the image viewer should be generally usable now though still some TODO's left.
Diffstat (limited to 'source/blender/editors/space_image/image_edit.c')
-rw-r--r-- | source/blender/editors/space_image/image_edit.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 8ae2b76cd4e..f80210fe4d7 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -47,6 +47,8 @@ #include "ED_screen.h" #include "ED_uvedit.h" +#include "UI_view2d.h" + #include "WM_api.h" #include "WM_types.h" @@ -250,6 +252,20 @@ void ED_image_get_uv_aspect(Image *ima, float *aspx, float *aspy) *aspy *= (float)h; } +void ED_image_mouse_pos(SpaceImage *sima, ARegion *ar, wmEvent *event, float co[2]) +{ + int sx, sy, width, height; + float zoomx, zoomy; + + ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy); + ED_space_image_get_size(sima, &width, &height); + + UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &sx, &sy); + + co[0] = ((event->mval[0] - sx) / zoomx) / width; + co[1] = ((event->mval[1] - sy) / zoomy) / height; +} + int ED_space_image_show_render(SpaceImage *sima) { return (sima->image && ELEM(sima->image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)); |