summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile_Evas.am1
-rw-r--r--src/lib/edje/edje_calc.c12
-rw-r--r--src/lib/ephysics/ephysics_body.cpp8
-rw-r--r--src/lib/evas/Evas_Eo.h1
-rw-r--r--src/lib/evas/Evas_Legacy.h39
-rw-r--r--src/lib/evas/canvas/efl_canvas_object.eo99
-rw-r--r--src/lib/evas/canvas/efl_canvas_proxy.eo2
-rw-r--r--src/lib/evas/canvas/efl_gfx_map.eo41
-rw-r--r--src/lib/evas/canvas/evas_map.c20
-rw-r--r--src/lib/evas/canvas/evas_object_main.c2
10 files changed, 112 insertions, 113 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 70a7c70..0560f93 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -46,6 +46,7 @@ evas_eolian_pub_files = \
46 lib/evas/canvas/efl_event_key.eo \ 46 lib/evas/canvas/efl_event_key.eo \
47 lib/evas/canvas/efl_event_pointer.eo \ 47 lib/evas/canvas/efl_event_pointer.eo \
48 lib/evas/canvas/efl_event_hold.eo \ 48 lib/evas/canvas/efl_event_hold.eo \
49 lib/evas/canvas/efl_gfx_map.eo \
49 $(NULL) 50 $(NULL)
50 51
51evas_eolian_legacy_files = \ 52evas_eolian_legacy_files = \
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 2bf8204..c0df2fd 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -5015,8 +5015,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
5015 else map_obj = mo; 5015 else map_obj = mo;
5016 if (map_obj) 5016 if (map_obj)
5017 { 5017 {
5018 efl_canvas_object_map_set(map_obj, map); 5018 evas_object_map_set(map_obj, map);
5019 efl_canvas_object_map_enable_set(map_obj, EINA_TRUE); 5019 evas_object_map_enable_set(map_obj, EINA_TRUE);
5020 } 5020 }
5021 } 5021 }
5022 else 5022 else
@@ -5027,8 +5027,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
5027 { 5027 {
5028 if (ep->nested_smart) /* Cancel map of smart obj holding nested parts */ 5028 if (ep->nested_smart) /* Cancel map of smart obj holding nested parts */
5029 { 5029 {
5030 efl_canvas_object_map_enable_set(ep->nested_smart, EINA_FALSE); 5030 evas_object_map_enable_set(ep->nested_smart, EINA_FALSE);
5031 efl_canvas_object_map_set(ep->nested_smart, NULL); 5031 evas_object_map_set(ep->nested_smart, NULL);
5032 } 5032 }
5033 else 5033 else
5034 { 5034 {
@@ -5038,8 +5038,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
5038#endif 5038#endif
5039 if (mo) 5039 if (mo)
5040 { 5040 {
5041 efl_canvas_object_map_enable_set(mo, 0); 5041 evas_object_map_enable_set(mo, 0);
5042 efl_canvas_object_map_set(mo, NULL); 5042 evas_object_map_set(mo, NULL);
5043 } 5043 }
5044#ifdef HAVE_EPHYSICS 5044#ifdef HAVE_EPHYSICS
5045 } 5045 }
diff --git a/src/lib/ephysics/ephysics_body.cpp b/src/lib/ephysics/ephysics_body.cpp
index 98da084..7c4754b 100644
--- a/src/lib/ephysics/ephysics_body.cpp
+++ b/src/lib/ephysics/ephysics_body.cpp
@@ -1372,7 +1372,7 @@ _ephysics_body_del(EPhysics_Body *body)
1372} 1372}
1373 1373
1374static void 1374static void
1375_ephysics_body_efl_canvas_object_map_apply(EPhysics_Body *body, Evas_Map *map, Evas_Object *obj, Eina_Bool bfc, Eina_Bool update_cw) 1375_ephysics_body_evas_object_map_apply(EPhysics_Body *body, Evas_Map *map, Evas_Object *obj, Eina_Bool bfc, Eina_Bool update_cw)
1376{ 1376{
1377 EPhysics_Camera *camera = ephysics_world_camera_get(body->world); 1377 EPhysics_Camera *camera = ephysics_world_camera_get(body->world);
1378 1378
@@ -1504,7 +1504,7 @@ _ephysics_cylinder_face_objs_update(EPhysics_Body *body)
1504 evas_map_util_quat_rotate(map, quat.x(), -quat.y(), quat.z(), -quat.w(), 1504 evas_map_util_quat_rotate(map, quat.x(), -quat.y(), quat.z(), -quat.w(),
1505 bx, by, z); 1505 bx, by, z);
1506 1506
1507 _ephysics_body_efl_canvas_object_map_apply(body, map, obj, EINA_TRUE, 1507 _ephysics_body_evas_object_map_apply(body, map, obj, EINA_TRUE,
1508 EINA_FALSE); 1508 EINA_FALSE);
1509 } 1509 }
1510} 1510}
@@ -1624,7 +1624,7 @@ _ephysics_box_face_objs_update(EPhysics_Body *body)
1624 1624
1625 evas_map_util_quat_rotate(map, quat.x(), -quat.y(), quat.z(), -quat.w(), 1625 evas_map_util_quat_rotate(map, quat.x(), -quat.y(), quat.z(), -quat.w(),
1626 x, y, z); 1626 x, y, z);
1627 _ephysics_body_efl_canvas_object_map_apply(body, map, obj, EINA_TRUE, 1627 _ephysics_body_evas_object_map_apply(body, map, obj, EINA_TRUE,
1628 EINA_FALSE); 1628 EINA_FALSE);
1629 } 1629 }
1630} 1630}
@@ -1680,7 +1680,7 @@ _ephysics_body_evas_object_update(EPhysics_Body *body, Evas_Object *evas_obj)
1680 evas_map_util_quat_rotate(map, quat.x(), -quat.y(), quat.z(), -quat.w(), 1680 evas_map_util_quat_rotate(map, quat.x(), -quat.y(), quat.z(), -quat.w(),
1681 bx, by, z); 1681 bx, by, z);
1682 1682
1683 _ephysics_body_efl_canvas_object_map_apply(body, map, evas_obj, 1683 _ephysics_body_evas_object_map_apply(body, map, evas_obj,
1684 body->back_face_culling, EINA_TRUE); 1684 body->back_face_culling, EINA_TRUE);
1685} 1685}
1686 1686
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index 37db8fb..cd9e217 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -278,6 +278,7 @@ typedef void (Evas_Canvas3D_Surface_Func)(Evas_Real *out_x,
278#include "canvas/efl_canvas_image.eo.h" 278#include "canvas/efl_canvas_image.eo.h"
279#include "canvas/efl_canvas_snapshot.eo.h" 279#include "canvas/efl_canvas_snapshot.eo.h"
280#include "canvas/efl_canvas_proxy.eo.h" 280#include "canvas/efl_canvas_proxy.eo.h"
281#include "canvas/efl_gfx_map.eo.h"
281#endif /* EFL_EO_API_SUPPORT */ 282#endif /* EFL_EO_API_SUPPORT */
282 283
283#ifdef EFL_BETA_API_SUPPORT 284#ifdef EFL_BETA_API_SUPPORT
diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h
index 4e75bff..7c59c26 100644
--- a/src/lib/evas/Evas_Legacy.h
+++ b/src/lib/evas/Evas_Legacy.h
@@ -5718,3 +5718,42 @@ EAPI void evas_output_size_set(Evas *e, int w, int h);
5718EAPI void evas_output_size_get(const Evas *e, int *w, int *h); 5718EAPI void evas_output_size_get(const Evas *e, int *w, int *h);
5719 5719
5720#include "canvas/evas_out.eo.legacy.h" 5720#include "canvas/evas_out.eo.legacy.h"
5721
5722/**
5723 * @brief Set current object transformation map.
5724 *
5725 * This sets the map on a given object. It is copied from the @c map pointer,
5726 * so there is no need to keep the @c map object if you don't need it anymore.
5727 *
5728 * A map is a set of 4 points which have canvas x, y coordinates per point,
5729 * with an optional z point value as a hint for perspective correction, if it
5730 * is available. As well each point has u and v coordinates. These are like
5731 * "texture coordinates" in OpenGL in that they define a point in the source
5732 * image that is mapped to that map vertex/point. The u corresponds to the x
5733 * coordinate of this mapped point and v, the y coordinate. Note that these
5734 * coordinates describe a bounding region to sample.
5735 *
5736 * @note The map points a uv coordinates match the image geometry. If the
5737 * @c map parameter is @c null, the stored map will be freed and geometry prior
5738 * to enabling/setting a map will be restored.
5739 *
5740 * @param[in] map The map.
5741 *
5742 * @ingroup Efl_Canvas_Object
5743 */
5744EAPI void evas_object_map_set(Evas_Object *obj, const Evas_Map *map);
5745
5746/**
5747 * @brief Get current object transformation map.
5748 *
5749 * This returns the current internal map set on the indicated object. It is
5750 * intended for read-only access and is only valid as long as the object is not
5751 * deleted or the map on the object is not changed.
5752 *
5753 * @return The map.
5754 *
5755 * @ingroup Efl_Canvas_Object
5756 */
5757EAPI const Evas_Map *evas_object_map_get(const Evas_Object *obj);
5758
5759#include "canvas/efl_gfx_map.eo.legacy.h"
diff --git a/src/lib/evas/canvas/efl_canvas_object.eo b/src/lib/evas/canvas/efl_canvas_object.eo
index d9b7955..90d3c34 100644
--- a/src/lib/evas/canvas/efl_canvas_object.eo
+++ b/src/lib/evas/canvas/efl_canvas_object.eo
@@ -2,7 +2,8 @@ import evas_types;
2import efl_text_types; 2import efl_text_types;
3 3
4abstract Efl.Canvas.Object (Eo.Base, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator, 4abstract Efl.Canvas.Object (Eo.Base, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
5 Efl.Input.Interface, Efl.Gfx.Size.Hint) 5 Efl.Input.Interface, Efl.Gfx.Size.Hint,
6 Efl.Gfx.Map)
6{ 7{
7 legacy_prefix: evas_object; 8 legacy_prefix: evas_object;
8 data: Evas_Object_Protected_Data; 9 data: Evas_Object_Protected_Data;
@@ -95,73 +96,6 @@ abstract Efl.Canvas.Object (Eo.Base, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
95 or not ($false).]] 96 or not ($false).]]
96 } 97 }
97 } 98 }
98 @property map {
99 set {
100 [[Set current object transformation map.
101
102 This sets the map on a given object. It is copied from the
103 $map pointer, so there is no need to keep the $map object if
104 you don't need it anymore.
105
106 A map is a set of 4 points which have canvas x, y coordinates
107 per point, with an optional z point value as a hint for
108 perspective correction, if it is available. As well each
109 point has u and v coordinates. These are like "texture
110 coordinates" in OpenGL in that they define a point in the
111 source image that is mapped to that map vertex/point. The u
112 corresponds to the x coordinate of this mapped point and v,
113 the y coordinate. Note that these coordinates describe a
114 bounding region to sample.
115
116 Note: The map points a uv coordinates match the image geometry.
117 If the $map parameter is $null, the stored map will be freed
118 and geometry prior to enabling/setting a map will be restored.
119 ]]
120 /* FIXME-doc
121 If you have a 200x100 source
122 image and want to display it at 200x100 with proper pixel
123 precision, then do:
124
125 @code
126 Evas_Map *m = evas_map_new(4);
127 evas_map_point_coord_set(m, 0, 0, 0, 0);
128 evas_map_point_coord_set(m, 1, 200, 0, 0);
129 evas_map_point_coord_set(m, 2, 200, 100, 0);
130 evas_map_point_coord_set(m, 3, 0, 100, 0);
131 evas_map_point_image_uv_set(m, 0, 0, 0);
132 evas_map_point_image_uv_set(m, 1, 200, 0);
133 evas_map_point_image_uv_set(m, 2, 200, 100);
134 evas_map_point_image_uv_set(m, 3, 0, 100);
135 evas_object_map_set(obj, m);
136 evas_map_free(m);
137 @endcode
138 */
139 }
140 get {
141 [[Get current object transformation map.
142
143 This returns the current internal map set on the indicated
144 object. It is intended for read-only access and is only
145 valid as long as the object is not deleted or the map on
146 the object is not changed.
147 ]]
148 /* FIXME-doc
149 If you wish to modify the map
150 and set it back do the following:
151
152 @code
153 const Evas_Map *m = evas_object_map_get(obj);
154 Evas_Map *m2 = evas_map_dup(m);
155 evas_map_util_rotate(m2, 30.0, 0, 0);
156 evas_object_map_set(obj, m2);
157 evas_map_free(m2);
158 @endcode
159 */
160 }
161 values {
162 map: const(Evas.Map)*; [[The map.]]
163 }
164 }
165 @property clip { 99 @property clip {
166 set { 100 set {
167 [[Clip one object to another. 101 [[Clip one object to another.
@@ -319,33 +253,6 @@ abstract Efl.Canvas.Object (Eo.Base, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
319 is_frame: bool; 253 is_frame: bool;
320 } 254 }
321 } 255 }
322 @property map_enable {
323 set {
324 [[Enable or disable the map that is set.
325
326 Enable or disable the use of map for the object $obj. On
327 enable, the object geometry will be saved, and the new
328 geometry will change (position and size) to reflect the
329 map geometry set.
330
331 If the object doesn't have a map set (with
332 \@ref evas_object_map_set), the initial geometry will be
333 undefined. It is advised to always set a map to the object
334 first, and then call this function to enable its use.
335 ]]
336 }
337 get {
338 [[Get the map enabled state
339
340 This returns the currently enabled state of the map on the
341 object indicated. The default map enable state is off. You
342 can enable and disable it with @.map_enable.set.
343 ]]
344 }
345 values {
346 enabled: bool; [[Enabled state.]]
347 }
348 }
349 @property precise_is_inside { 256 @property precise_is_inside {
350 set { 257 set {
351 [[Set whether to use precise (usually expensive) point collision 258 [[Set whether to use precise (usually expensive) point collision
@@ -708,6 +615,8 @@ abstract Efl.Canvas.Object (Eo.Base, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
708 Efl.Gfx.Size.Hint.hint_request.get; 615 Efl.Gfx.Size.Hint.hint_request.get;
709 Efl.Gfx.Size.Hint.hint_weight.set; 616 Efl.Gfx.Size.Hint.hint_weight.set;
710 Efl.Gfx.Size.Hint.hint_weight.get; 617 Efl.Gfx.Size.Hint.hint_weight.get;
618 Efl.Gfx.Map.map_enable.set;
619 Efl.Gfx.Map.map_enable.get;
711 } 620 }
712 events { 621 events {
713 mouse,in @beta; [[Mouse In Event ]] 622 mouse,in @beta; [[Mouse In Event ]]
diff --git a/src/lib/evas/canvas/efl_canvas_proxy.eo b/src/lib/evas/canvas/efl_canvas_proxy.eo
index caae9e7..b8048fb 100644
--- a/src/lib/evas/canvas/efl_canvas_proxy.eo
+++ b/src/lib/evas/canvas/efl_canvas_proxy.eo
@@ -15,7 +15,7 @@ class Efl.Canvas.Proxy (Efl.Canvas.Image.Internal, Efl.Gfx.Buffer)
15 source object in its drawing region, without affecting that 15 source object in its drawing region, without affecting that
16 source in any way. The source must be another valid @Efl.Canvas.Object. 16 source in any way. The source must be another valid @Efl.Canvas.Object.
17 Other effects may be applied to the proxy, such as a map (see 17 Other effects may be applied to the proxy, such as a map (see
18 @Efl.Canvas.Object.map) to create a reflection of the original object 18 @Efl.Gfx.Map) to create a reflection of the original object
19 (for example). 19 (for example).
20 20
21 Any existing source object will be removed after this call. 21 Any existing source object will be removed after this call.
diff --git a/src/lib/evas/canvas/efl_gfx_map.eo b/src/lib/evas/canvas/efl_gfx_map.eo
new file mode 100644
index 0000000..ea9e363
--- /dev/null
+++ b/src/lib/evas/canvas/efl_gfx_map.eo
@@ -0,0 +1,41 @@
1mixin Efl.Gfx.Map (Eo.Interface, Eo.Base)
2{
3 [[Texture UV mapping for all objects (rotation, perspective, 3d, ...).
4
5 Evas allows different transformations to be applied to all kinds of
6 objects. These are applied by means of UV mapping.
7
8 With UV mapping, one maps points in the source object to a 3D space
9 positioning at target. This allows rotation, perspective, scale and
10 lots of other effects, depending on the map that is used.
11
12 Each map point may carry a multiplier color. If properly
13 calculated, these can do shading effects on the object, producing
14 3D effects.
15 ]]
16 data: null;
17 methods {
18 @property map_enable @virtual_pure {
19 [[Whether map transformation is enabled on this object.
20
21 The default map enable state is off ($false).
22 ]]
23 set {
24 [[Enable or disable the use of map for this object. On
25 enable, the object geometry will be saved, and the new
26 geometry will change (position and size) to reflect the
27 map geometry set.
28 ]]
29 legacy: evas_object_map_enable_set;
30 }
31 get {
32 legacy: evas_object_map_enable_get;
33 }
34 values {
35 enabled: bool; [[Enabled state.]]
36 }
37 }
38 }
39 implements {
40 }
41}
diff --git a/src/lib/evas/canvas/evas_map.c b/src/lib/evas/canvas/evas_map.c
index 4873733..4f07bfb 100644
--- a/src/lib/evas/canvas/evas_map.c
+++ b/src/lib/evas/canvas/evas_map.c
@@ -464,8 +464,9 @@ _evas_object_map_parent_check(Evas_Object *eo_parent)
464} 464}
465 465
466EOLIAN void 466EOLIAN void
467_efl_canvas_object_map_enable_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Eina_Bool enabled) 467_efl_canvas_object_efl_gfx_map_map_enable_set(Eo *eo_obj, void *_pd EINA_UNUSED, Eina_Bool enabled)
468{ 468{
469 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
469 Eina_Bool pchange = EINA_FALSE; 470 Eina_Bool pchange = EINA_FALSE;
470 471
471 enabled = !!enabled; 472 enabled = !!enabled;
@@ -533,14 +534,17 @@ _efl_canvas_object_map_enable_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, E
533} 534}
534 535
535EOLIAN Eina_Bool 536EOLIAN Eina_Bool
536_efl_canvas_object_map_enable_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) 537_efl_canvas_object_efl_gfx_map_map_enable_get(Eo *eo_obj EINA_UNUSED, void *_pd EINA_UNUSED)
537{ 538{
539 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
538 return obj->map->cur.usemap; 540 return obj->map->cur.usemap;
539} 541}
540 542
541EOLIAN void 543EAPI void
542_efl_canvas_object_map_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, const Evas_Map *map) 544evas_object_map_set(Evas_Object *eo_obj, const Evas_Map *map)
543{ 545{
546 Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN(eo_obj);
547
544 evas_object_async_block(obj); 548 evas_object_async_block(obj);
545 if ((!map) || (map->count < 4)) 549 if ((!map) || (map->count < 4))
546 { 550 {
@@ -630,9 +634,11 @@ _efl_canvas_object_map_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, const Ev
630 _evas_map_calc_map_geometry(eo_obj); 634 _evas_map_calc_map_geometry(eo_obj);
631} 635}
632 636
633EOLIAN Evas_Map * 637EAPI const Evas_Map *
634_efl_canvas_object_map_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) 638evas_object_map_get(const Evas_Object *eo_obj)
635{ 639{
640 Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN((Eo *) eo_obj, NULL);
641
636 evas_object_async_block(obj); 642 evas_object_async_block(obj);
637 return obj->map->cur.map; 643 return obj->map->cur.map;
638} 644}
@@ -1358,3 +1364,5 @@ evas_map_object_move_diff_set(Evas_Map *m,
1358 m->move_sync.diff_x += diff_x; 1364 m->move_sync.diff_x += diff_x;
1359 m->move_sync.diff_y += diff_y; 1365 m->move_sync.diff_y += diff_y;
1360} 1366}
1367
1368#include "canvas/efl_gfx_map.eo.c"
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c
index 6d26b77..0008a23 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -877,7 +877,7 @@ _efl_canvas_object_efl_gfx_position_set(Eo *eo_obj, Evas_Object_Protected_Data *
877 if ((obj->cur->geometry.x == x) && (obj->cur->geometry.y == y)) return; 877 if ((obj->cur->geometry.x == x) && (obj->cur->geometry.y == y)) return;
878 878
879 Evas_Map *map; 879 Evas_Map *map;
880 map = (Evas_Map *) efl_canvas_object_map_get(eo_obj); 880 map = (Evas_Map *) evas_object_map_get(eo_obj);
881 if (map && map->move_sync.enabled) 881 if (map && map->move_sync.enabled)
882 { 882 {
883 Evas_Coord diff_x = x - obj->cur->geometry.x; 883 Evas_Coord diff_x = x - obj->cur->geometry.x;