Hi,

        This patch add support for a new fill.type argument. Fill.type could be 
:
        - SCALE : Relative coord in the fill section are relative to the 
container 
(like without the patch) and it's the default value.

        - TILE : Relative coord are relative to the image size (not anymore to 
the 
container). This does not impact use of offset in fill section.

Cedric

diff -Nrua -X exclude.cvs e17-clean/libs/edje/src/bin/edje_cc_handlers.c e17-dev/libs/edje/src/bin/edje_cc_handlers.c
--- e17-clean/libs/edje/src/bin/edje_cc_handlers.c	2007-06-04 09:17:09.000000000 +0200
+++ e17-dev/libs/edje/src/bin/edje_cc_handlers.c	2007-07-06 11:09:50.000000000 +0200
@@ -83,6 +83,7 @@
 static void st_collections_group_parts_part_description_fill_size_offset(void);
 static void st_collections_group_parts_part_description_fill_angle(void);
 static void st_collections_group_parts_part_description_fill_spread(void);
+static void st_collections_group_parts_part_description_fill_type(void);
 static void st_collections_group_parts_part_description_color_class(void);
 static void st_collections_group_parts_part_description_color(void);
 static void st_collections_group_parts_part_description_color2(void);
@@ -229,6 +230,7 @@
      {"collections.group.parts.part.description.fill.size.offset", st_collections_group_parts_part_description_fill_size_offset},
      {"collections.group.parts.part.description.fill.angle", st_collections_group_parts_part_description_fill_angle},
      {"collections.group.parts.part.description.fill.spread", st_collections_group_parts_part_description_fill_spread},
+     {"collections.group.parts.part.description.fill.type", st_collections_group_parts_part_description_fill_type},
      {"collections.group.parts.part.description.color_class", st_collections_group_parts_part_description_color_class},
      {"collections.group.parts.part.description.color", st_collections_group_parts_part_description_color},
      {"collections.group.parts.part.description.color2", st_collections_group_parts_part_description_color2},
@@ -1151,6 +1153,7 @@
    ed->fill.abs_y = 0;
    ed->fill.angle = 0;
    ed->fill.spread = 0;
+   ed->fill.type = EDJE_FILL_TYPE_SCALE;
    ed->color_class = NULL;
    ed->color.r = 255;
    ed->color.g = 255;
@@ -2659,6 +2662,34 @@
 }
 
 static void
+st_collections_group_parts_part_description_fill_type(void)
+{
+   Edje_Part_Collection *pc;
+   Edje_Part *ep;
+   Edje_Part_Description *ed;
+
+   check_arg_count(1);
+
+   pc = evas_list_data(evas_list_last(edje_collections));
+   ep = evas_list_data(evas_list_last(pc->parts));
+   ed = ep->default_desc;
+   if (ep->other_desc) ed = evas_list_data(evas_list_last(ep->other_desc));
+
+   if (ep->type != EDJE_PART_TYPE_IMAGE)
+     {
+	fprintf(stderr, "%s: Error. parse error %s:%i. "
+		"fill attributes in non-IMAGE part.\n",
+		progname, file_in, line - 1);
+	exit(-1);
+     }
+
+   ed->fill.type = parse_enum(0,
+                              "SCALE", EDJE_FILL_TYPE_SCALE,
+                              "TILE", EDJE_FILL_TYPE_TILE,
+                              NULL);
+}
+
+static void
 st_collections_group_programs_program_action(void)
 {
    Edje_Part_Collection *pc;
diff -Nrua -X exclude.cvs e17-clean/libs/edje/src/lib/edje_calc.c e17-dev/libs/edje/src/lib/edje_calc.c
--- e17-clean/libs/edje/src/lib/edje_calc.c	2007-06-04 09:17:09.000000000 +0200
+++ e17-dev/libs/edje/src/lib/edje_calc.c	2007-07-06 11:24:51.000000000 +0200
@@ -974,13 +974,37 @@
 	params->smooth = desc->fill.smooth;
 	if (flags & FLAG_X)
 	  {
-	     params->fill.x = desc->fill.pos_abs_x + (params->w * desc->fill.pos_rel_x);
-	     params->fill.w = desc->fill.abs_x + (params->w * desc->fill.rel_x);
+             if (desc->fill.type == EDJE_FILL_TYPE_TILE)
+               {
+                  int   iw;
+
+                  evas_object_image_size_get(ep->object, &iw, NULL);
+
+                  params->fill.x = desc->fill.pos_abs_x + (iw * desc->fill.pos_rel_x);
+                  params->fill.w = desc->fill.abs_x + (iw * desc->fill.rel_x);
+               }
+             else
+               {
+                  params->fill.x = desc->fill.pos_abs_x + (params->w * desc->fill.pos_rel_x);
+                  params->fill.w = desc->fill.abs_x + (params->w * desc->fill.rel_x);
+               }
 	  }
 	if (flags & FLAG_Y)
 	  {
-	     params->fill.y = desc->fill.pos_abs_y + (params->h * desc->fill.pos_rel_y);
-	     params->fill.h = desc->fill.abs_y + (params->h * desc->fill.rel_y);
+             if (desc->fill.type == EDJE_FILL_TYPE_TILE)
+               {
+                  int   ih;
+
+                  evas_object_image_size_get(ep->object, NULL, &ih);
+
+                  params->fill.y = desc->fill.pos_abs_y + (ih * desc->fill.pos_rel_y);
+                  params->fill.h = desc->fill.abs_y + (ih * desc->fill.rel_y);
+               }
+             else
+               {
+                  params->fill.y = desc->fill.pos_abs_y + (params->h * desc->fill.pos_rel_y);
+                  params->fill.h = desc->fill.abs_y + (params->h * desc->fill.rel_y);
+               }
 	  }
 	params->fill.angle = desc->fill.angle;
 	params->fill.spread = desc->fill.spread;
diff -Nrua -X exclude.cvs e17-clean/libs/edje/src/lib/edje_data.c e17-dev/libs/edje/src/lib/edje_data.c
--- e17-clean/libs/edje/src/lib/edje_data.c	2007-06-04 09:17:09.000000000 +0200
+++ e17-dev/libs/edje/src/lib/edje_data.c	2007-07-06 11:07:28.000000000 +0200
@@ -293,6 +293,7 @@
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.abs_y", fill.abs_y, EET_T_INT);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.angle", fill.angle, EET_T_INT);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.spread", fill.spread, EET_T_INT);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.type", fill.type, EET_T_CHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color_class", color_class, EET_T_STRING);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color.r", color.r, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color.g", color.g, EET_T_UCHAR);
diff -Nrua -X exclude.cvs e17-clean/libs/edje/src/lib/edje_private.h e17-dev/libs/edje/src/lib/edje_private.h
--- e17-clean/libs/edje/src/lib/edje_private.h	2007-07-04 15:00:23.000000000 +0200
+++ e17-dev/libs/edje/src/lib/edje_private.h	2007-07-05 18:58:04.000000000 +0200
@@ -504,6 +504,7 @@
       int            angle; /* angle of fill -- currently only used by grads */
       int            spread; /* spread of fill -- currently only used by grads */
       char           smooth; /* fill with smooth scaling or not */
+      unsigned char  type; /* fill coordinate from container (SCALE) or from source image (TILE) */
    } fill;
    
    char             *color_class; /* how to modify the color */
@@ -884,6 +884,12 @@
    unsigned char     *msg;
 };
 
+typedef enum _Edje_Fill
+{
+   EDJE_FILL_TYPE_SCALE = 0,
+     EDJE_FILL_TYPE_TILE
+} Edje_Fill;
+
 EAPI extern Eet_Data_Descriptor *_edje_edd_edje_file;
 EAPI extern Eet_Data_Descriptor *_edje_edd_edje_style;
 EAPI extern Eet_Data_Descriptor *_edje_edd_edje_style_tag;
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to