forked from enlightenment/efl
fix color premul complaints in examples
this should fix T498
This commit is contained in:
parent
cf2ae7397e
commit
9c96c4fa36
|
@ -13,12 +13,7 @@ _colorselector_changed_cb(void *data, Evas_Object *obj,
|
||||||
|
|
||||||
elm_colorselector_color_get(obj, &r, &g, &b, &a);
|
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);
|
printf("Changed Color [r=%d g=%d b=%d a=%d]\n", r, g, b, a);
|
||||||
|
evas_color_argb_premul(&a, &r, &g, &b);
|
||||||
/* Fix Alpha pre multiplication by edje */
|
|
||||||
r = (r * a) / 255;
|
|
||||||
g = (g * a) / 255;
|
|
||||||
b = (b * a) / 255;
|
|
||||||
|
|
||||||
evas_object_color_set(re, r, g, b, a);
|
evas_object_color_set(re, r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,8 @@ _change_color(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
int r, g, b, a;
|
int r, g, b, a;
|
||||||
elm_colorselector_color_get(obj, &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);
|
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;
|
int r = 0, g = 0, b = 0 ,a = 0;
|
||||||
Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
|
Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
|
||||||
elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a);
|
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);
|
evas_object_color_set(data, r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ static void
|
||||||
_transit_color(Elm_Transit *trans)
|
_transit_color(Elm_Transit *trans)
|
||||||
{
|
{
|
||||||
/* changes the object color from 100, 255, 100, 255 to
|
/* changes the object color from 100, 255, 100, 255 to
|
||||||
* 200, 50, 200, 50 */
|
* 40, 10, 40, 50 */
|
||||||
elm_transit_effect_color_add(trans, 100, 255, 100, 255, 200, 50, 200, 50);
|
elm_transit_effect_color_add(trans, 100, 255, 100, 255, 40, 10, 40, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue