Update image effect 23/12623/1
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 20 Nov 2013 08:11:06 +0000 (17:11 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Wed, 20 Nov 2013 08:11:06 +0000 (17:11 +0900)
Change-Id: I25e48ad37f6950acc68067d9fd1a72be7f7671f7

icon_src/script_handler.c

index 78bbfce..4e9097b 100644 (file)
 #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;
@@ -83,6 +89,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;
 };
@@ -248,6 +262,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,%x", &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 == ' ') {
@@ -291,6 +323,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,
@@ -404,6 +440,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) {
@@ -675,6 +714,17 @@ 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 0
+       img_opt.shadow.enabled = 1;
+       img_opt.shadow.angle = -90;
+       img_opt.shadow.offset = 2;
+       img_opt.shadow.softness = 4;
+       img_opt.shadow.color = 0x99000000;
+#endif
+       if (img_opt.shadow.enabled) {
+               /* TODO */
+       }
+
        /*!
         * \note
         * object will be shown by below statement automatically