From 26a4c38d670b8f0a55ada9c981f46452bde2ee3e Mon Sep 17 00:00:00 2001 From: Dave Andreoli Date: Sat, 15 Jul 2017 17:30:19 +0200 Subject: New 1.20 API: evas.Map.coords_get --- efl/evas/efl.evas_map.pxi | 24 ++++++++++++++++++++++++ include/efl.evas.pxd | 1 + 2 files changed, 25 insertions(+) diff --git a/efl/evas/efl.evas_map.pxi b/efl/evas/efl.evas_map.pxi index 2e5ade4..bea2407 100644 --- a/efl/evas/efl.evas_map.pxi +++ b/efl/evas/efl.evas_map.pxi @@ -394,6 +394,30 @@ cdef class Map(object): evas_map_point_coord_get(self.map, idx, &x, &y, &z) return (x, y, z) + def coords_get(self, double x, double y, int grab): + """Apply a map transformation on given coordinate. + + :param x: point x source coordinate + :type x: double + :param y: point y source coordinate + :type y: double + :param grab: unknown + :type grab: int + + :return: coordinates after transformation by map + :rtype: tuple of 2 doubles (mx, my) + + :raise RuntimeError: when interpolation fail + + .. versionadded:: 1.20 + + """ + cdef double mx, my + if evas_map_coords_get(self.map, x, y, &mx, &my, grab) == 0: + raise(RuntimeError("Map interpolation failed")) + else: + return (mx, my) + # # XXX: Can't use property here since getter has an argument. # diff --git a/include/efl.evas.pxd b/include/efl.evas.pxd index 63cf8f5..ad33ff1 100644 --- a/include/efl.evas.pxd +++ b/include/efl.evas.pxd @@ -822,6 +822,7 @@ cdef extern from "Evas.h": void evas_map_point_image_uv_get(const Evas_Map *m, int idx, double *u, double *v) void evas_map_point_color_set(Evas_Map *m, int idx, int r, int g, int b, int a) void evas_map_point_color_get(const Evas_Map *m, int idx, int *r, int *g, int *b, int *a) + Eina_Bool evas_map_coords_get(const Evas_Map *m, double x, double y, double *mx, double *my, int grab) #################################################################### -- cgit v1.1