raster pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=d71c5af33b9b62475987f44ff3fae0eeacff6437

commit d71c5af33b9b62475987f44ff3fae0eeacff6437
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Sat Nov 16 10:21:03 2013 +0900

    fix color premul complaints in examples
    
    this should fix T498
---
 src/bin/test_colorselector.c            | 7 +------
 src/examples/colorselector_example_01.c | 4 ++++
 src/examples/transit_example_03.c       | 4 ++--
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/bin/test_colorselector.c b/src/bin/test_colorselector.c
index 6fb4d6e..32fb4dc 100644
--- a/src/bin/test_colorselector.c
+++ b/src/bin/test_colorselector.c
@@ -13,12 +13,7 @@ _colorselector_changed_cb(void *data, Evas_Object *obj,
 
    elm_colorselector_color_get(obj, &r, &g, &b, &a);
    printf("Changed Color [r=%d g=%d b=%d a=%d]\n", r, g, b, a);
-
-   /* Fix Alpha pre multiplication by edje */
-   r = (r * a) / 255;
-   g = (g * a) / 255;
-   b = (b * a) / 255;
-
+   evas_color_argb_premul(&a, &r, &g, &b);
    evas_object_color_set(re, r, g, b, a);
 }
 
diff --git a/src/examples/colorselector_example_01.c 
b/src/examples/colorselector_example_01.c
index 2afa8b6..f1ade43 100644
--- a/src/examples/colorselector_example_01.c
+++ b/src/examples/colorselector_example_01.c
@@ -67,6 +67,8 @@ _change_color(void *data, Evas_Object *obj, void *event_info)
 {
    int r, g, b, a;
    elm_colorselector_color_get(obj, &r, &g, &b, &a);
+   // ensure colors are pre-multiplied by alpha
+   evas_color_argb_premul(a, &r, &g, &b);
    evas_object_color_set(data, r, g, b, a);
 }
 
@@ -76,6 +78,8 @@ _colorpalette_clicked_cb(void *data, Evas_Object *obj, void 
*event_info)
    int r = 0, g = 0, b = 0 ,a = 0;
    Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
    elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a);
+   // ensure colors are pre-multiplied by alpha
+   evas_color_argb_premul(a, &r, &g, &b);
    evas_object_color_set(data, r, g, b, a);
 }
 
diff --git a/src/examples/transit_example_03.c 
b/src/examples/transit_example_03.c
index 79d6094..f0a9a01 100644
--- a/src/examples/transit_example_03.c
+++ b/src/examples/transit_example_03.c
@@ -27,8 +27,8 @@ static void
 _transit_color(Elm_Transit *trans)
 {
    /* changes the object color from 100, 255, 100, 255 to
-    * 200, 50, 200, 50 */
-   elm_transit_effect_color_add(trans, 100, 255, 100, 255, 200, 50, 200, 50);
+    * 40, 10, 40, 50 */
+   elm_transit_effect_color_add(trans, 100, 255, 100, 255, 40, 10, 40, 50);
 }
 
 static void

-- 


Reply via email to