edje: Adding the zoom effect of map to edje
authorjiin.moon <jiin.moon@samsung.com>
Mon, 2 Mar 2015 11:19:01 +0000 (20:19 +0900)
committerChunEon Park <chuneon.park@samsung.com>
Mon, 2 Mar 2015 11:19:01 +0000 (20:19 +0900)
Summary:
Support zoom effect of map in edje
@feature

Reviewers: Hermet

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2068

src/bin/edje/edje_cc_handlers.c
src/lib/edje/edje_calc.c
src/lib/edje/edje_data.c
src/lib/edje/edje_main.c
src/lib/edje/edje_private.h

index 138e248..d9ce1d7 100644 (file)
@@ -409,6 +409,8 @@ static void st_collections_group_parts_part_description_map_alpha(void);
 static void st_collections_group_parts_part_description_map_backface_cull(void);
 static void st_collections_group_parts_part_description_map_perspective_on(void);
 static void st_collections_group_parts_part_description_map_color(void);
+static void st_collections_group_parts_part_description_map_zoom_x(void);
+static void st_collections_group_parts_part_description_map_zoom_y(void);
 static void st_collections_group_parts_part_description_perspective_zplane(void);
 static void st_collections_group_parts_part_description_perspective_focal(void);
 static void st_collections_group_parts_part_api(void);
@@ -808,6 +810,8 @@ New_Statement_Handler statement_handlers[] =
      {"collections.group.parts.part.description.map.backface_cull", st_collections_group_parts_part_description_map_backface_cull},
      {"collections.group.parts.part.description.map.perspective_on", st_collections_group_parts_part_description_map_perspective_on},
      {"collections.group.parts.part.description.map.color", st_collections_group_parts_part_description_map_color},
+     {"collections.group.parts.part.description.map.zoom.x", st_collections_group_parts_part_description_map_zoom_x},
+     {"collections.group.parts.part.description.map.zoom.y", st_collections_group_parts_part_description_map_zoom_y},
      {"collections.group.parts.part.description.perspective.zplane", st_collections_group_parts_part_description_perspective_zplane},
      {"collections.group.parts.part.description.perspective.focal", st_collections_group_parts_part_description_perspective_focal},
      {"collections.group.parts.part.description.params.int", st_collections_group_parts_part_description_params_int},
@@ -1114,6 +1118,7 @@ New_Object_Handler object_handlers[] =
 #endif
      {"collections.group.parts.part.description.map", NULL},
      {"collections.group.parts.part.description.map.rotation", NULL},
+     {"collections.group.parts.part.description.map.zoom", NULL},
      {"collections.group.parts.part.description.perspective", NULL},
      {"collections.group.parts.part.description.params", NULL},
      {"collections.group.parts.part.description.color_classes", NULL}, /* dup */
@@ -6279,6 +6284,8 @@ ob_collections_group_parts_part_description(void)
    ed->map.backcull = 0;
    ed->map.persp_on = 0;
    ed->map.colors = NULL;
+   ed->map.zoom.x = FROM_DOUBLE(1.0);
+   ed->map.zoom.y = FROM_DOUBLE(1.0);
    ed->persp.zplane = 0;
    ed->persp.focal = 1000;
    ed->minmul.have = 1;
@@ -10564,6 +10571,41 @@ st_collections_group_parts_part_description_map_color(void)
    current_desc->map.colors[current_desc->map.colors_count - 1] = color;
 }
 
+/**
+    @page edcref
+    @property
+        x
+    @parameters
+        [X horizontal zoom to use]
+    @effect
+        This sets the zoom rate of the horizontal
+    @endproperty
+*/
+static void
+st_collections_group_parts_part_description_map_zoom_x(void)
+{
+   check_arg_count(1);
+
+   current_desc->map.zoom.x = FROM_DOUBLE(parse_float(0));
+}
+
+/**
+    @page edcref
+    @property
+        y
+    @parameters
+        [Y vertical zoom to use]
+    @effect
+        This sets the zoom rate of vertical
+    @endproperty
+*/
+static void
+st_collections_group_parts_part_description_map_zoom_y(void)
+{
+   check_arg_count(1);
+
+   current_desc->map.zoom.y = FROM_DOUBLE(parse_float(0));
+}
 
 /** @edcsubsection{collections_group_parts_description_map_rotation,
  *                 Group.Parts.Part.Description.Map.Rotation} */
index eab8ab1..20569bf 100644 (file)
@@ -2189,6 +2189,8 @@ _edje_part_recalc_single_map(Edje *ed,
         params_write->rotation.x = desc->map.rot.x;
         params_write->rotation.y = desc->map.rot.y;
         params_write->rotation.z = desc->map.rot.z;
+        params_write->zoom.x = desc->map.zoom.x;
+        params_write->zoom.y = desc->map.zoom.y;
 
         if (light)
           {
@@ -3110,6 +3112,9 @@ _edje_map_prop_set(Evas_Map *map, const  Edje_Calc_Params *pf,
    // handle alpha
    if (chosen_desc->map.alpha) evas_map_alpha_set(map, EINA_TRUE);
    else evas_map_alpha_set(map, EINA_FALSE);
+   evas_map_util_zoom(map,
+                      pf->map->zoom.x, pf->map->zoom.y,
+                      pf->map->center.x, pf->map->center.y);
 }
 
 #define Rel1X 0
@@ -3674,6 +3679,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
                   p3_write->rotation.x = FFP(p1->map->rotation.x, p2->map->rotation.x, pos);
                   p3_write->rotation.y = FFP(p1->map->rotation.y, p2->map->rotation.y, pos);
                   p3_write->rotation.z = FFP(p1->map->rotation.z, p2->map->rotation.z, pos);
+                  p3_write->zoom.x = FFP(p1->map->zoom.x, p2->map->zoom.x, pos);
+                  p3_write->zoom.y = FFP(p1->map->zoom.y, p2->map->zoom.y, pos);
 
 #define MIX(P1, P2, P3, pos, info)                                      \
                   P3->info = P1->map->info + TO_INT(SCALE(pos, P2->map->info - P1->map->info));
index afd1e6d..774d9c2 100644 (file)
@@ -592,6 +592,8 @@ _edje_edd_init(void)
       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.persp_on", map.persp_on, EET_T_UCHAR); \
       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.backcull", map.backcull, EET_T_UCHAR); \
       EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(Edd, Type, "map.color", map.colors, _edje_edd_edje_map_colors_pointer); \
+      EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.zoom.x", map.zoom.x, EDJE_T_FLOAT); \
+      EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.zoom.y", map.zoom.y, EDJE_T_FLOAT); \
       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.zplane", persp.zplane, EET_T_INT); \
       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.focal", persp.focal, EET_T_INT);
 
@@ -679,6 +681,8 @@ _edje_edd_init(void)
       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.persp_on", Dec.map.persp_on, EET_T_UCHAR); \
       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.backcull", Dec.map.backcull, EET_T_UCHAR); \
       EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(Edd, Type, "map.color", Dec.map.colors, _edje_edd_edje_map_colors_pointer); \
+      EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.zoom.x", Dec.map.zoom.x, EDJE_T_FLOAT); \
+      EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.zoom.y", Dec.map.zoom.y, EDJE_T_FLOAT); \
       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.zplane", Dec.persp.zplane, EET_T_INT); \
       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.focal", Dec.persp.focal, EET_T_INT); \
 
index 8fb742f..9813287 100644 (file)
@@ -14,7 +14,7 @@ Eina_Cow *_edje_calc_params_map_cow = NULL;
 Eina_Cow *_edje_calc_params_physics_cow = NULL;
 
 static const Edje_Calc_Params_Map default_calc_map = {
-  { 0, 0, 0 }, { 0.0, 0.0, 0.0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0 }, NULL, 0
+  { 0, 0, 0 }, { 0.0, 0.0, 0.0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0.0, 0.0 }, NULL, 0
 };
 
 static const Edje_Calc_Params_Physics default_calc_physics = {
index 476e196..906dca5 100644 (file)
@@ -1148,6 +1148,9 @@ struct _Edje_Part_Description_Common
          int id_center;
          FLOAT_T x, y, z;
       } rot;
+      struct {
+         FLOAT_T x, y;
+      } zoom;
       Edje_Map_Color **colors;    /* List of the Edje_Map_Color */
       unsigned int colors_count;
       Eina_Bool backcull;
@@ -1588,6 +1591,9 @@ struct _Edje_Calc_Params_Map
       int x, y, z;
       int focal;
    } persp; // 16
+   struct {
+      FLOAT_T x, y;
+   } zoom; //16
    Edje_Map_Color **colors;
    unsigned int colors_count;
 };