add border_scale option for images - image border will scale based on edje
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 21 Feb 2010 06:53:44 +0000 (06:53 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 21 Feb 2010 06:53:44 +0000 (06:53 +0000)
scale factors. this is independant of scale: per part.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@46341 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

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

index b7db137..fdb727a 100644 (file)
@@ -162,6 +162,7 @@ static void st_collections_group_parts_part_description_image_normal(void);
 static void st_collections_group_parts_part_description_image_tween(void);
 static void st_collections_group_parts_part_description_image_border(void);
 static void st_collections_group_parts_part_description_image_middle(void);
+static void st_collections_group_parts_part_description_image_border_scale(void);
 static void st_collections_group_parts_part_description_image_scale_hint(void);
 static void st_collections_group_parts_part_description_fill_smooth(void);
 static void st_collections_group_parts_part_description_fill_origin_relative(void);
@@ -383,6 +384,7 @@ New_Statement_Handler statement_handlers[] =
      {"collections.group.parts.part.description.image.images.image", st_images_image}, /* dup */
      {"collections.group.parts.part.description.image.border", st_collections_group_parts_part_description_image_border},
      {"collections.group.parts.part.description.image.middle", st_collections_group_parts_part_description_image_middle},
+     {"collections.group.parts.part.description.image.border_scale", st_collections_group_parts_part_description_image_border_scale},
      {"collections.group.parts.part.description.image.scale_hint", st_collections_group_parts_part_description_image_scale_hint},
      {"collections.group.parts.part.description.fill.smooth", st_collections_group_parts_part_description_fill_smooth},
      {"collections.group.parts.part.description.fill.origin.relative", st_collections_group_parts_part_description_fill_origin_relative},
@@ -4114,6 +4116,45 @@ st_collections_group_parts_part_description_image_middle(void)
 /**
     @page edcref
     @property
+        scale
+    @parameters
+        0, 1
+    @effect
+        If border is set, this value tells Edje if the border should be scaled
+        by the object/global edje scale factors
+    @endproperty
+*/
+static void
+st_collections_group_parts_part_description_image_border_scale(void)
+{
+   Edje_Part_Collection *pc;
+   Edje_Part *ep;
+   Edje_Part_Description *ed;
+
+   check_arg_count(1);
+
+   pc = eina_list_data_get(eina_list_last(edje_collections));
+   ep = eina_list_data_get(eina_list_last(pc->parts));
+
+   if (ep->type != EDJE_PART_TYPE_IMAGE)
+     {
+       ERR("%s: Error. parse error %s:%i. "
+           "image attributes in non-IMAGE part.",
+           progname, file_in, line - 1);
+       exit(-1);
+     }
+
+   ed = ep->default_desc;
+   if (ep->other_desc) ed = eina_list_data_get(eina_list_last(ep->other_desc));
+   ed->border.scale =  parse_enum(0,
+                                  "1", 0,
+                                  "0", 1,
+                                  NULL);
+}
+
+/**
+    @page edcref
+    @property
         scale_hint
     @parameters
         0, NONE, DYNAMIC, STATIC
index e700f97..2f688de 100644 (file)
@@ -1501,10 +1501,14 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
 {
    int image_id;
    int image_count, image_num;
+   FLOAT_T sc;
 
+   sc = ed->scale;
+   if (sc == 0.0) sc = _edje_scale;
    evas_object_image_fill_set(ep->object, p3->type.common.fill.x, p3->type.common.fill.y,
                              p3->type.common.fill.w, p3->type.common.fill.h);
    evas_object_image_smooth_scale_set(ep->object, p3->smooth);
+   evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc));
    evas_object_image_border_set(ep->object, p3->type.common.spec.image.l, p3->type.common.spec.image.r,
                                p3->type.common.spec.image.t, p3->type.common.spec.image.b);
    if (chosen_desc->border.no_fill == 0)
index 8ed33ad..7f63c2c 100644 (file)
@@ -284,6 +284,7 @@ _edje_edd_init(void)
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.t", border.t, EET_T_INT);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.b", border.b, EET_T_INT);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.no_fill", border.no_fill, EET_T_UCHAR);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.scale", border.scale, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.smooth", fill.smooth, EET_T_CHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.pos_rel_x", fill.pos_rel_x, EDJE_T_FLOAT);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.pos_abs_x", fill.pos_abs_x, EET_T_INT);
index ebdeab9..e72886b 100644 (file)
@@ -609,6 +609,7 @@ struct _Edje_Part_Description
    struct {
       int            l, r, t, b; /* border scaling on image fill */
       unsigned char  no_fill; /* do we fill the center of the image if bordered? 1 == NO!!!! */
+      unsigned char  scale; /* scale image border by same as scale factor */
    } border;
 
    struct {