New 1.20 API: evas.Map.coords_get

This commit is contained in:
Davide Andreoli 2017-07-15 17:30:19 +02:00
parent 15b29e3ce8
commit 26a4c38d67
2 changed files with 25 additions and 0 deletions

View File

@ -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.
#

View File

@ -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)
####################################################################