From cafd52670e73581dc9c3247572652656d25308a5 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Wed, 30 Jan 2013 05:30:18 +0000 Subject: [PATCH] Add new description type for changing the color To change the color of specified part,. This new interface is introduced. Change-Id: I6d88867dee649bc15c9301717b7655540c4d4745 --- include/script_port.h | 1 + packaging/liblivebox-edje.spec | 2 +- src/script_port.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/include/script_port.h b/include/script_port.h index 7d23efd..441c94b 100644 --- a/include/script_port.h +++ b/include/script_port.h @@ -25,6 +25,7 @@ extern int script_signal_emit(Evas *e, const char *part, const char *signal, dou /*! * Implement below functions */ +extern int script_update_color(void *h, Evas *e, const char *id, const char *part, const char *rgba); extern int script_update_text(void *h, Evas *e, const char *id, const char *part, const char *text); extern int script_update_image(void *h, Evas *e, const char *id, const char *part, const char *path); extern int script_update_script(void *h, Evas *e, const char *src_id, const char *target_id, const char *part, const char *path, const char *group); diff --git a/packaging/liblivebox-edje.spec b/packaging/liblivebox-edje.spec index a717741..3a4200e 100644 --- a/packaging/liblivebox-edje.spec +++ b/packaging/liblivebox-edje.spec @@ -1,6 +1,6 @@ Name: liblivebox-edje Summary: EDJE Script loader for the data provider master -Version: 0.1.20 +Version: 0.1.21 Release: 1 Group: framework/livebox License: Flora License diff --git a/src/script_port.c b/src/script_port.c index 9f8ca00..e8a11c8 100644 --- a/src/script_port.c +++ b/src/script_port.c @@ -142,6 +142,35 @@ const char *script_magic_id(void) return "edje"; } +int script_update_color(void *h, Evas *e, const char *id, const char *part, const char *rgba) +{ + struct info *handle = h; + Evas_Object *edje; + int r[3], g[3], b[3], a[3]; + int ret; + + edje = find_edje(handle, id); + if (!edje) + return -ENOENT; + + ret = sscanf(rgba, "%d %d %d %d %d %d %d %d %d %d %d %d", + r, g, b, a, /* OBJECT */ + r + 1, g + 1, b + 1, a + 1, /* OUTLINE */ + r + 2, g + 2, b + 2, a + 2); /* SHADOW */ + if (ret != 12) { + DbgPrint("id[%s] part[%s] rgba[%s]\n", id, part, rgba); + return -EINVAL; + } + + ret = edje_object_color_class_set(edje, part, + r[0], g[0], b[0], a[0], /* OBJECT */ + r[1], g[1], b[1], a[1], /* OUTLINE */ + r[2], g[2], b[2], a[2]); /* SHADOW */ + + DbgPrint("EDJE[%s] color class is %s changed", id, ret == EINA_TRUE ? "successfully" : "not"); + return 0; +} + int script_update_text(void *h, Evas *e, const char *id, const char *part, const char *text) { struct info *handle = h; -- 2.7.4