Apply icon shadow effect.
authorSung-jae Park <nicesj.park@samsung.com>
Fri, 25 Oct 2013 04:41:29 +0000 (13:41 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Fri, 25 Oct 2013 06:16:07 +0000 (15:16 +0900)
Change-Id: I88b686530b044904ff507663b05dda53c1c89f88
Signed-off-by: Sung-jae Park <nicesj.park@samsung.com>
CMakeLists.txt
data/icon.edc
icon_src/script_handler.c
packaging/com.samsung.data-provider-slave.spec

index 1084ae8..f41bbf3 100644 (file)
@@ -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)
index cbf17ae..2df2d1c 100644 (file)
@@ -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
                                }
                         }
 
index db496d1..fa01b5f 100644 (file)
@@ -9,6 +9,7 @@
 #include <Eina.h>
 #include <Edje.h>
 #include <Ecore.h>
+#include <efl_assist.h>
 
 #include <dlog.h>
 #include <livebox-errno.h>
 #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
index 42f4630..65226e5 100644 (file)
@@ -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)