add border_scale_by that adds another scaling factor for border
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 10 Oct 2011 05:53:02 +0000 (05:53 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 10 Oct 2011 05:53:02 +0000 (05:53 +0000)
scaling. use it as a way of super-sampling borders (eg use 0.5 to use
2x over-sampling, 0.25 for 4x oversapling etc.)

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@63938 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 e4a72f1..b64a53b 100644 (file)
@@ -191,6 +191,7 @@ 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_border_scale_by(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);
@@ -450,6 +451,7 @@ New_Statement_Handler statement_handlers[] =
      {"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.border_scale_by", st_collections_group_parts_part_description_image_border_scale_by},
      {"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},
@@ -4896,6 +4898,43 @@ st_collections_group_parts_part_description_image_middle(void)
 /**
     @page edcref
     @property
+        border_scale_by
+    @parameters
+        0.0 or bigger (0.0 or 1.0 to turn it off)
+    @effect
+        If border scaling is enabled then normally the OUTPUT border sizes
+        (e.g. if 3 pixels on the left edge are set as a border, then normally
+        at scale 1.0, those 3 columns will always be the exact 3 columns of
+        output, or at scale 2.0 they will be 6 columns, or 0.33 they will merge
+        into a single column). This property multiplies the input scale
+        factor by this multiplier, allowing the creation of "supersampled"
+        borders to make much higher resolution outputs possible by always using
+        the highest resolution artwork and then runtime scaling it down.
+    @endproperty
+*/
+static void
+st_collections_group_parts_part_description_image_border_scale_by(void)
+{
+   Edje_Part_Description_Image *ed;
+
+   check_arg_count(1);
+
+   if (current_part->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 = (Edje_Part_Description_Image*) current_desc;
+
+   ed->image.border.scale_by = FROM_DOUBLE(parse_float_range(0, 0.0, 999999999.0));
+}
+
+/**
+    @page edcref
+    @property
         border_scale
     @parameters
         0, 1
index 4230b27..1b8a21a 100644 (file)
@@ -1876,7 +1876,15 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
                              p3->type.common.fill.w, p3->type.common.fill.h);
    evas_object_image_smooth_scale_set(ep->object, p3->smooth);
    if (chosen_desc->image.border.scale)
-     evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc));
+     {
+        if (chosen_desc->image.border.scale_by > FROM_DOUBLE(0.0))
+          {
+             FLOAT_T sc2 = MUL(sc, chosen_desc->image.border.scale_by);
+             evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc2));
+          }
+        else
+           evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc));
+     }
    else
      evas_object_image_border_scale_set(ep->object, 1.0);
    evas_object_image_border_set(ep->object, p3->type.common.spec.image.l, p3->type.common.spec.image.r,
index 12130f7..a9e6197 100644 (file)
@@ -554,6 +554,7 @@ _edje_edd_init(void)
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.b", image.border.b, EET_T_INT);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.no_fill", image.border.no_fill, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.scale", image.border.scale, EET_T_UCHAR);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.scale_by", image.border.scale_by, EDJE_T_FLOAT);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.smooth", image.fill.smooth, EET_T_CHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.pos_rel_x", image.fill.pos_rel_x, EDJE_T_FLOAT);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.pos_abs_x", image.fill.pos_abs_x, EET_T_INT);
index 0793c55..4c383bd 100644 (file)
@@ -847,6 +847,7 @@ struct _Edje_Part_Description_Spec_Border
    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 */
+   FLOAT_T        scale_by; /* when border scale above is enabled, border width OUTPUT is scaled by the object or global scale factor. this value adds another multiplier that the global scale is multiplued by first. if <= 0.0 it is not used, and if 1.0 it i s "ineffective" */
 };
 
 struct _Edje_Part_Description_Spec_Image