+2013-06-06 ChunEon Park (Hermet)
+
+ * Edje: support edc map color set
+
2013-06-05 Jiyou Park
* Evas: Fix gif cannot decode alpha value correctly.
- Add edje_object_part_text_input_panel_layout_variation_set/get API
- Add EDJE_INPUT_PANEL_LAYOUT_DATETIME layout
- support edc proxy.source_visible, proxy.source_clip
+ - support edc map color set
* Eeze:
- Add a dummy libmount replacement for when libmount is not there.
* Ecore_Con:
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_perspective_zplane(void);
static void st_collections_group_parts_part_description_perspective_focal(void);
static void st_collections_group_parts_part_api(void);
{"collections.group.parts.part.description.map.alpha", st_collections_group_parts_part_description_map_alpha},
{"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.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},
current_item->rowspan = parse_int_range(1, 1, 0xffff);
}
+static Eina_List *
+_copied_map_colors_get(Edje_Part_Description_Common *parent)
+{
+ Eina_List *colors = NULL;
+ Eina_List *l;
+ Edje_Map_Color *color;
+ EINA_LIST_FOREACH(parent->map.colors, l, color)
+ {
+ Edje_Map_Color *c = mem_alloc(SZ(Edje_Map_Color));
+ if (!color)
+ {
+ ERR("not enough memory");
+ exit(-1);
+ return NULL;
+ }
+ memcpy(c, color, sizeof(Edje_Map_Color));
+ colors = eina_list_append(colors, c);
+ }
+ return colors;
+}
+
/**
@edcsubsection{collections_group_parts_description,Description}
*/
ed->map.alpha = 1;
ed->map.backcull = 0;
ed->map.persp_on = 0;
+ ed->map.colors = NULL;
ed->persp.zplane = 0;
ed->persp.focal = 1000;
ed->minmul.have = 1;
#define STRDUP(x) x ? strdup(x) : NULL
ed->color_class = STRDUP(ed->color_class);
+ ed->map.colors = _copied_map_colors_get(parent);
+
switch (ep->type)
{
case EDJE_PART_TYPE_SPACER:
current_desc->map.persp_on = parse_bool(0);
}
+static void
+st_collections_group_parts_part_description_map_color(void)
+{
+ check_arg_count(5);
+
+ Edje_Map_Color *color = mem_alloc(SZ(Edje_Map_Color));
+ if (!color)
+ {
+ ERR("not enough memory");
+ exit(-1);
+ return;
+ }
+ color->idx = parse_int(0);
+ color->r = parse_int_range(1, 0, 255);
+ color->g = parse_int_range(2, 0, 255);
+ color->b = parse_int_range(3, 0, 255);
+ color->a = parse_int_range(4, 0, 255);
+
+ Eina_List *l;
+ Edje_Map_Color *ex_color;
+ EINA_LIST_FOREACH(current_desc->map.colors, l, ex_color)
+ {
+ if (ex_color->idx != color->idx) continue;
+ ex_color->r = color->r;
+ ex_color->g = color->g;
+ ex_color->b = color->b;
+ ex_color->a = color->a;
+ return;
+ }
+ current_desc->map.colors = eina_list_append(current_desc->map.colors, color);
+}
+
+
/**
@edcsubsection{collections_group_parts_description_map_rotation,Rotation}
*/
params_write->persp.focal = persp->param1.description->persp.focal;
}
}
+ params_write->colors = desc->map.colors;
}
EINA_COW_CALC_MAP_END(params, params_write);
}
}
#endif
+#define FINTP(_x1, _x2, _p) \
+ (((_x1) == (_x2)) \
+ ? FROM_INT((_x1)) \
+ : ADD(FROM_INT(_x1), \
+ SCALE((_p), (_x2) - (_x1))))
+
+#define FFP(_x1, _x2, _p) \
+ (((_x1) == (_x2)) \
+ ? (_x1) \
+ : ADD(_x1, MUL(_p, SUB(_x2, _x1))));
+
+#define INTP(_x1, _x2, _p) TO_INT(FINTP(_x1, _x2, _p))
+
+static Eina_Bool
+map_colors_interp(Edje_Calc_Params *p1, Edje_Calc_Params *p2,
+ Edje_Calc_Params_Map *pmap, FLOAT_T pos)
+{
+ Eina_List *l, *l2;
+ Edje_Map_Color *col, *col2, *col3;
+ Eina_Bool matched = EINA_FALSE;
+
+ if (p1->map->colors || p2->map->colors)
+ {
+ EINA_LIST_FOREACH(p1->map->colors, l, col)
+ {
+ col3 = calloc(1, sizeof(Edje_Map_Color));
+ col3->idx = col->idx;
+
+ EINA_LIST_FOREACH(p2->map->colors, l2, col2)
+ {
+ if (col->idx != col2->idx) continue;
+ col3->r = INTP(col->r, col2->r, pos);
+ col3->g = INTP(col->g, col2->g, pos);
+ col3->b = INTP(col->b, col2->b, pos);
+ col3->a = INTP(col->a, col2->a, pos);
+ pmap->colors = eina_list_append(pmap->colors, col3);
+ matched = EINA_TRUE;
+ break;
+ }
+ if (!matched)
+ {
+ col3->r = INTP(col->r, 255, pos);
+ col3->g = INTP(col->g, 255, pos);
+ col3->b = INTP(col->b, 255, pos);
+ col3->a = INTP(col->a, 255, pos);
+ pmap->colors = eina_list_append(pmap->colors, col3);
+ }
+ matched = EINA_FALSE;
+ }
+ EINA_LIST_FOREACH(p2->map->colors, l, col)
+ {
+ EINA_LIST_FOREACH(p1->map->colors, l2, col2)
+ {
+ if (col->idx != col2->idx) continue;
+ matched = EINA_TRUE;
+ break;
+ }
+ if (!matched)
+ {
+ col3 = calloc(1, sizeof(Edje_Map_Color));
+ col3->idx = col->idx;
+ col3->r = INTP(255, col->r, pos);
+ col3->g = INTP(255, col->g, pos);
+ col3->b = INTP(255, col->b, pos);
+ col3->a = INTP(255, col->a, pos);
+ pmap->colors = eina_list_append(pmap->colors, col3);
+ }
+ matched = EINA_FALSE;
+ }
+ return EINA_TRUE;
+ }
+
+ return EINA_FALSE;
+}
+
+static void
+_edje_map_color_update(Evas_Map *map, const Edje_Calc_Params_Map *pmap,
+ Eina_Bool map_colors_free)
+{
+ Eina_List *colors = pmap->colors;
+ Edje_Map_Color *color;
+ Eina_List *l;
+
+ if (!colors)
+ {
+ evas_map_point_color_set(map, 0, 255, 255, 255, 255);
+ evas_map_point_color_set(map, 1, 255, 255, 255, 255);
+ evas_map_point_color_set(map, 2, 255, 255, 255, 255);
+ evas_map_point_color_set(map, 3, 255, 255, 255, 255);
+ return;
+ }
+
+ if (map_colors_free)
+ {
+ EINA_LIST_FREE(colors, color)
+ {
+ evas_map_point_color_set(map, color->idx, color->r, color->g,
+ color->b, color->a);
+ free(color);
+ }
+ }
+ else
+ {
+ EINA_LIST_FOREACH(colors, l, color)
+ {
+ evas_map_point_color_set(map, color->idx, color->r, color->g,
+ color->b, color->a);
+ }
+ }
+}
+
#define Rel1X 0
#define Rel1Y 1
-#define Rel2X 2
-#define Rel2Y 3
+#define Rel2X 2
+#define Rel2Y 3
void
_edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state)
FLOAT_T pos = ZERO, pos2;
Edje_Calc_Params lp3;
Evas_Coord mmw = 0, mmh = 0;
+ Eina_Bool map_colors_free = EINA_FALSE;
/* GRADIENT ARE GONE, WE MUST IGNORE IT FROM OLD FILE. */
if (ep->part->type == EDJE_PART_TYPE_GRADIENT)
p3->smooth = (beginning_pos) ? p1->smooth : p2->smooth;
/* FIXME: do x and y separately base on flag */
-#define FINTP(_x1, _x2, _p) \
- (((_x1) == (_x2)) \
- ? FROM_INT((_x1)) \
- : ADD(FROM_INT(_x1), \
- SCALE((_p), (_x2) - (_x1))))
-
-#define FFP(_x1, _x2, _p) \
- (((_x1) == (_x2)) \
- ? (_x1) \
- : ADD(_x1, MUL(_p, SUB(_x2, _x1))));
-
-#define INTP(_x1, _x2, _p) TO_INT(FINTP(_x1, _x2, _p))
p3->x = INTP(p1->x, p2->x, pos);
p3->y = INTP(p1->y, p2->y, pos);
#define MIX(P1, P2, P3, pos, info) \
P3->info = P1->map->info + TO_INT(SCALE(pos, P2->map->info - P1->map->info));
+ map_colors_free = map_colors_interp(p1, p2, p3_write, pos);
if (p1->lighted && p2->lighted)
{
eina_cow_free(_edje_calc_params_physics_cow, lp2.physics);
#endif
#endif
-
pf = p3;
}
else
evas_map_point_image_uv_set(map, 2, iw , ih );
evas_map_point_image_uv_set(map, 3, 0.0, ih );
}
+
+ _edje_map_color_update(map, pf->map, map_colors_free);
+
evas_map_util_3d_rotate(map,
TO_DOUBLE(pf->map->rotation.x),
TO_DOUBLE(pf->map->rotation.y),
Eet_Data_Descriptor *_edje_edd_edje_external_param = NULL;
Eet_Data_Descriptor *_edje_edd_edje_part_limit = NULL;
Eet_Data_Descriptor *_edje_edd_edje_physics_face = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_map_colors = NULL;
#define EMP(Type, Minus) \
EAPI Eina_Mempool *_emp_##Type = NULL; \
FREED(_edje_edd_edje_image_directory_set_entry);
FREED(_edje_edd_edje_part_limit);
FREED(_edje_edd_edje_physics_face);
+ FREED(_edje_edd_edje_map_colors);
}
#define EDJE_DEFINE_POINTER_TYPE(Type, Name) \
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_physics_face, Edje_Physics_Face, "type", type, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_physics_face, Edje_Physics_Face, "source", source, EET_T_STRING);
+ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Map_Color);
+ _edje_edd_edje_map_colors = eet_data_descriptor_file_new(&eddc);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_map_colors, Edje_Map_Color,
+ "idx", idx, EET_T_UINT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_map_colors, Edje_Map_Color,
+ "r", r, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_map_colors, Edje_Map_Color,
+ "g", g, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_map_colors, Edje_Map_Color,
+ "b", b, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_map_colors, Edje_Map_Color,
+ "a", a, EET_T_UCHAR);
+
#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_FIELDS(Edd, Type) \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.name", state.name, EET_T_STRING); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.value", state.value, EET_T_DOUBLE); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.alpha", map.alpha, EET_T_UCHAR); \
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_LIST(Edd, Type, "map.color", map.colors, _edje_edd_edje_map_colors); \
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);
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.alpha", Dec.map.alpha, EET_T_UCHAR); \
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_LIST(Edd, Type, "map.color", Dec.map.colors, _edje_edd_edje_map_colors); \
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); \
pd->map.rot.x = FROM_DOUBLE(0.0);
pd->map.rot.y = FROM_DOUBLE(0.0);
pd->map.rot.z = FROM_DOUBLE(0.0);
+ pd->map.colors = NULL;
pd->map.on = EINA_FALSE;
pd->map.smooth = EINA_TRUE;
pd->map.alpha = EINA_TRUE;
unsigned char r, g, b, a;
};
+struct _Edje_Map_Color
+{
+ int idx;
+ unsigned char r;
+ unsigned char g;
+ unsigned char b;
+ unsigned char a;
+};
+
struct _Edje_Aspect_Prefer
{
FLOAT_T min, max;
typedef struct _Edje_Size Edje_Size;
typedef struct _Edje_Rectangle Edje_Rectangle;
typedef struct _Edje_Color Edje_Color;
+typedef struct _Edje_Map_Color Edje_Map_Color;
typedef struct _Edje_Aspect_Prefer Edje_Aspect_Prefer;
typedef struct _Edje_Aspect Edje_Aspect;
typedef struct _Edje_String Edje_String;
struct {
FLOAT_T relative_x;
- FLOAT_T relative_y;
+ FLOAT_T relative_y;
int offset_x;
int offset_y;
int id_x; /* -1 = whole part collection, or part ID */
int id_center;
FLOAT_T x, y, z;
} rot;
+ Eina_List *colors; //Edje_Map_Color, consider to apply Eina_Hash
Eina_Bool backcull;
Eina_Bool on;
Eina_Bool persp_on;
int x, y, z;
int focal;
} persp; // 16
+ Eina_List *colors;
};
struct _Edje_Calc_Params_Physics