From: Sung-jae Park Date: Fri, 25 Oct 2013 04:41:29 +0000 (+0900) Subject: Apply icon shadow effect. X-Git-Tag: submit/tizen_mobile/20150512.125148^2~1^2~15^2~9^2~114 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=80642734350e20e68dc21d8cf5b778bc8179ccaf;p=platform%2Fcore%2Fappfw%2Fdata-provider-slave.git Apply icon shadow effect. Change-Id: I88b686530b044904ff507663b05dda53c1c89f88 Signed-off-by: Sung-jae Park --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1084ae8..f41bbf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ pkg_check_modules(pkg REQUIRED capi-system-system-settings com-core shortcut + efl-assist ) SET(PACKAGE "${PROJECT_NAME}") @@ -54,10 +55,28 @@ ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET") ADD_DEFINITIONS(${pkg_CFLAGS}) +FOREACH(flag ${pkg_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") + SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} -Wall") + # -fpie SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Winline -Werror -g -fno-builtin-malloc") #SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") +SET(EXTRA_LDFLAGS "-ldl") +FOREACH(flag ${pkg_LDFLAGS}) + IF (flag STREQUAL -L) + MESSAGE("Ignore -L") + ELSE() + SET(EXTRA_LDFLAGS "${EXTRA_LDFLAGS} ${flag}") + ENDIF() +ENDFOREACH(flag) +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_LDFLAGS}") + ADD_EXECUTABLE("${PROJECT_NAME}.loader" src/main.c src/so_handler.c @@ -69,19 +88,19 @@ ADD_EXECUTABLE("${PROJECT_NAME}.loader" src/client.c src/critical_log.c ) -TARGET_LINK_LIBRARIES("${PROJECT_NAME}.loader" ${pkg_LDFLAGS} "-ldl") +TARGET_LINK_LIBRARIES("${PROJECT_NAME}.loader" ${EXTRA_LDFLAGS}) ADD_EXECUTABLE(${ICON_PROVIDER} icon_src/main.c icon_src/script_handler.c src/util.c ) -TARGET_LINK_LIBRARIES(${ICON_PROVIDER} ${pkg_LDFLAGS} "-ldl") +TARGET_LINK_LIBRARIES(${ICON_PROVIDER} ${EXTRA_LDFLAGS}) ADD_EXECUTABLE(${EXE_LOADER} stub/main.c ) -TARGET_LINK_LIBRARIES(${EXE_LOADER} ${pkg_LDFLAGS} "-ldl") +TARGET_LINK_LIBRARIES(${EXE_LOADER} ${EXTRA_LDFLAGS}) #INSTALL(FILES ${CMAKE_SOURCE_DIR}/com.samsung.data-provider-slave.desktop DESTINATION /usr/share/applications) INSTALL(FILES ${CMAKE_SOURCE_DIR}/com.samsung.data-provider-slave.xml DESTINATION /usr/share/packages) diff --git a/data/icon.edc b/data/icon.edc index cbf17ae..2df2d1c 100644 --- a/data/icon.edc +++ b/data/icon.edc @@ -15,7 +15,6 @@ */ images { - image: "icon_shadow.png" COMP; image: "shortcut_bg_1x1.png" COMP; } @@ -36,12 +35,12 @@ collections { part { name: "bg"; - type: IMAGE; + type: RECT; description { state: "default" 0.0; rel1 { relative: 23/175 11/175; } - rel2 { relative: 152/175 140/175; } - image { normal: "icon_shadow.png"; } + rel2 { relative: 160/175 150/175; } + color: 0 0 0 0; align: 0.5 0.5; aspect: 1.0 1.0; aspect_preference: BOTH; @@ -52,8 +51,8 @@ collections { name: "icon"; type: SWALLOW; description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } + rel1 { relative: 6/137 0/139; to, "bg"; } + rel2 { relative: 131/137 130/139; to, "bg"; } // 117x117 125x127 } } @@ -99,14 +98,14 @@ collections { parts { part { name: "bg"; - type: IMAGE; + type: RECT; description { state: "default" 0.0; rel1 { relative: 112.5/354 11/175; } - rel2 { relative: 241.5/354 140/175; } - image { normal: "icon_shadow.png"; } + rel2 { relative: 249.5/354 150/175; } align: 0.5 0.5; aspect: 1.0 1.0; + color: 0 0 0 0; aspect_preference: BOTH; } } @@ -115,8 +114,8 @@ collections { name: "icon"; type: SWALLOW; description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } + rel1 { relative: 6/137 0/139; to, "bg"; } + rel2 { relative: 131/137 130/139; to, "bg"; } // 117x117 125x127 } } @@ -162,12 +161,12 @@ collections { parts { part { name: "bg"; - type: IMAGE; + type: RECT; description { state: "default" 0.0; rel1 { relative: 112.5/354 100.5/354; } - rel2 { relative: 241.5/354 229.5/354; } - image { normal: "icon_shadow.png"; } + rel2 { relative: 249.5/354 239.5/354; } + color: 0 0 0 0; align: 0.5 0.5; aspect: 1.0 1.0; aspect_preference: BOTH; @@ -178,8 +177,8 @@ collections { name: "icon"; type: SWALLOW; description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } + rel1 { relative: 6/137 0/139; to, "bg"; } + rel2 { relative: 131/137 130/139; to, "bg"; } // 117x117 125x127 } } @@ -225,12 +224,12 @@ collections { parts { part { name: "bg"; - type: IMAGE; + type: RECT; description { state: "default" 0.0; rel1 { relative: 291.5/712 11/175; } - rel2 { relative: 420.5/712 140/175; } - image { normal: "icon_shadow.png"; } + rel2 { relative: 428.5/712 150/175; } + color: 0 0 0 0; align: 0.5 0.5; aspect: 1.0 1.0; aspect_preference: BOTH; @@ -241,8 +240,8 @@ collections { name: "icon"; type: SWALLOW; description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } + rel1 { relative: 6/137 0/139; to, "bg"; } + rel2 { relative: 131/137 130/139; to, "bg"; } // 117x117 125x127 } } @@ -288,12 +287,12 @@ collections { parts { part { name: "bg"; - type: IMAGE; + type: RECT; description { state: "default" 0.0; rel1 { relative: 291.5/712 100.5/354; } - rel2 { relative: 420.5/712 229.5/354; } - image { normal: "icon_shadow.png"; } + rel2 { relative: 428.5/712 239.5/354; } + color: 0 0 0 0; align: 0.5 0.5; aspect: 1.0 1.0; aspect_preference: BOTH; @@ -304,8 +303,8 @@ collections { name: "icon"; type: SWALLOW; description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } + rel1 { relative: 6/137 0/139; to, "bg"; } + rel2 { relative: 131/137 130/139; to, "bg"; } // 117x117 125x127 } } @@ -351,12 +350,12 @@ collections { parts { part { name: "bg"; - type: IMAGE; + type: RECT; description { state: "default" 0.0; rel1 { relative: 291.5/712 190/533; } - rel2 { relative: 420.5/712 319/533; } - image { normal: "icon_shadow.png"; } + rel2 { relative: 428.5/712 329/533; } + color: 0 0 0 0; align: 0.5 0.5; aspect: 1.0 1.0; aspect_preference: BOTH; @@ -367,8 +366,8 @@ collections { name: "icon"; type: SWALLOW; description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } + rel1 { relative: 6/137 0/139; to, "bg"; } + rel2 { relative: 131/137 130/139; to, "bg"; } // 117x117 125x127 } } @@ -414,12 +413,12 @@ collections { parts { part { name: "bg"; - type: IMAGE; + type: RECT; description { state: "default" 0.0; rel1 { relative: 291.5/712 279.5/712; } - rel2 { relative: 420.5/712 408.5/712; } - image { normal: "icon_shadow.png"; } + rel2 { relative: 428.5/712 418.5/712; } + color: 0 0 0 0; align: 0.5 0.5; aspect: 1.0 1.0; aspect_preference: BOTH; @@ -430,8 +429,8 @@ collections { name: "icon"; type: SWALLOW; description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } + rel1 { relative: 6/137 0/139; to, "bg"; } + rel2 { relative: 131/137 130/139; to, "bg"; } // 117x117 125x127 } } @@ -477,12 +476,12 @@ collections { parts { part { name: "bg"; - type: IMAGE; + type: RECT; description { state: "default" 0.0; rel1 { relative: 291.5/712 369/891; } - rel2 { relative: 420.5/712 498/891; } - image { normal: "icon_shadow.png"; } + rel2 { relative: 428.5/712 508/891; } + color: 0 0 0 0; align: 0.5 0.5; aspect: 1.0 1.0; aspect_preference: BOTH; @@ -493,8 +492,8 @@ collections { name: "icon"; type: SWALLOW; description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } + rel1 { relative: 6/137 0/139; to, "bg"; } + rel2 { relative: 131/137 130/139; to, "bg"; } // 117x117 125x127 } } @@ -540,12 +539,12 @@ collections { parts { part { name: "bg"; - type: IMAGE; + type: RECT; description { state: "default" 0.0; rel1 { relative: 291.5/712 458.5/1070; } - rel2 { relative: 420.5/712 587.5/1070; } - image { normal: "icon_shadow.png"; } + rel2 { relative: 428.5/712 597.5/1070; } + color: 0 0 0 0; align: 0.5 0.5; aspect: 1.0 1.0; aspect_preference: BOTH; @@ -556,8 +555,8 @@ collections { name: "icon"; type: SWALLOW; description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } + rel1 { relative: 6/137 0/139; to, "bg"; } + rel2 { relative: 131/137 130/139; to, "bg"; } // 117x117 125x127 } } diff --git a/icon_src/script_handler.c b/icon_src/script_handler.c index db496d1..fa01b5f 100644 --- a/icon_src/script_handler.c +++ b/icon_src/script_handler.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -35,6 +36,12 @@ #define INFO_CATEGORY "category" #define ADDEND 256 +#if defined(TIZEN_ENGINEER_MODE) +#define ENGINEER_MODE_ENABLED 1 +#else +#define ENGINEER_MODE_ENABLED 0 +#endif + struct block { char *type; int type_len; @@ -67,6 +74,14 @@ struct image_option { FILL_OVER_SIZE, } fill; + struct shadow { + int enabled; + int angle; + int offset; + int softness; + int color; + } shadow; + int width; int height; }; @@ -232,6 +247,24 @@ static void parse_size(struct image_option *img_opt, const char *value, int len) free(buf); } +static void parse_shadow(struct image_option *img_opt, const char *value, int len) +{ + int angle; + int offset; + int softness; + int color; + + if (sscanf(value, "%d,%d,%d,%d", &angle, &offset, &softness, &color) != 4) { + ErrPrint("Invalid shadow [%s]\n", value); + } else { + img_opt->shadow.enabled = 1; + img_opt->shadow.angle = angle; + img_opt->shadow.offset = offset; + img_opt->shadow.softness = softness; + img_opt->shadow.color = color; + } +} + static void parse_fill(struct image_option *img_opt, const char *value, int len) { while (len > 0 && *value == ' ') { @@ -275,6 +308,10 @@ static inline void parse_image_option(const char *option, struct image_option *i .cmd = "size", .handler = parse_size, }, + { + .cmd = "shadow", + .handler = parse_shadow, + }, }; enum { STATE_START, @@ -388,6 +425,9 @@ static int update_script_image(Evas_Object *edje, struct block *block) .fill = FILL_DISABLE, .width = -1, .height = -1, + .shadow = { + .enabled = 0, + }, }; if (block->id) { @@ -659,6 +699,26 @@ static int update_script_image(Evas_Object *edje, struct block *block) evas_object_size_hint_weight_set(img, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); } + if (img_opt.shadow.enabled) { + ea_effect_h *ea_effect; + + ea_effect = ea_image_effect_create(); + if (ea_effect) { + // -90, 2, 4, 0x99000000 + ea_image_effect_add_outer_shadow(ea_effect, img_opt.shadow.angle, img_opt.shadow.offset, img_opt.shadow.softness, img_opt.shadow.color); + ea_object_image_effect_set(img, ea_effect); + + if (ENGINEER_MODE_ENABLED) { + int x, y, w, h; + ea_image_effect_offset_get(ea_effect, &x, &y); + evas_object_image_size_get(img, &w, &h); + DbgPrint("Effect applied (%dx%d) - (%dx%d), (%d,%d,%d,%d)\n", x, y, w, h, img_opt.shadow.angle, img_opt.shadow.offset, img_opt.shadow.softness, img_opt.shadow.color); + } + + ea_image_effect_destroy(ea_effect); + } + } + /*! * \note * object will be shown by below statement automatically diff --git a/packaging/com.samsung.data-provider-slave.spec b/packaging/com.samsung.data-provider-slave.spec index 42f4630..65226e5 100644 --- a/packaging/com.samsung.data-provider-slave.spec +++ b/packaging/com.samsung.data-provider-slave.spec @@ -2,7 +2,7 @@ Name: com.samsung.data-provider-slave Summary: Plugin type livebox service provider. -Version: 0.12.13 +Version: 0.12.14 Release: 1 Group: HomeTF/Livebox License: Flora License @@ -31,6 +31,7 @@ BuildRequires: pkgconfig(livebox) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(com-core) BuildRequires: pkgconfig(shortcut) +BuildRequires: pkgconfig(efl-assist) BuildRequires: hash-signer BuildRequires: pkgconfig(capi-system-system-settings)