summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorU. Artie Eoff <ullysses.a.eoff@intel.com>2013-11-22 15:07:14 -0800
committerU. Artie Eoff <ullysses.a.eoff@intel.com>2013-11-22 15:35:03 -0800
commit9c1466e19315852352886078d988579a80162c41 (patch)
tree5a3668ae0b735c6186bab6e2794b8a8711f8e42c /src/examples
parent26df676e06e34f257e17152043511366665f82c2 (diff)
evas/examples: fix clipper colors in evas-object-manipulation
This makes the clipper colors correct and also gets rid of the following error message spam: ERR..._color_set() Evas only handles pre multiplied colors! Fixes T557 Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/evas/evas-object-manipulation-eo.c6
-rw-r--r--src/examples/evas/evas-object-manipulation.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/examples/evas/evas-object-manipulation-eo.c b/src/examples/evas/evas-object-manipulation-eo.c
index 2fc5c8d887..03941aad22 100644
--- a/src/examples/evas/evas-object-manipulation-eo.c
+++ b/src/examples/evas/evas-object-manipulation-eo.c
@@ -77,10 +77,13 @@ _on_keydown(void *data EINA_UNUSED,
77 int alpha, r, g, b; 77 int alpha, r, g, b;
78 78
79 eo_do(d.clipper, evas_obj_color_get(&r, &g, &b, &alpha)); 79 eo_do(d.clipper, evas_obj_color_get(&r, &g, &b, &alpha));
80 evas_color_argb_unpremul(alpha, &r, &g, &b);
81
80 alpha -= 20; 82 alpha -= 20;
81 if (alpha < 0) 83 if (alpha < 0)
82 alpha = 255; 84 alpha = 255;
83 85
86 evas_color_argb_premul(alpha, &r, &g, &b);
84 eo_do(d.clipper, evas_obj_color_set(r, g, b, alpha)); 87 eo_do(d.clipper, evas_obj_color_set(r, g, b, alpha));
85 88
86 fprintf(stdout, "Changing clipper's opacity: %d%%\n", 89 fprintf(stdout, "Changing clipper's opacity: %d%%\n",
@@ -96,6 +99,8 @@ _on_keydown(void *data EINA_UNUSED,
96 fprintf(stdout, "Changing clipper's color to"); 99 fprintf(stdout, "Changing clipper's color to");
97 100
98 eo_do(d.clipper, evas_obj_color_get(&r, &g, &b, &alpha)); 101 eo_do(d.clipper, evas_obj_color_get(&r, &g, &b, &alpha));
102 evas_color_argb_unpremul(alpha, &r, &g, &b);
103
99 if (g > 0) 104 if (g > 0)
100 { 105 {
101 fprintf(stdout, "red\n"); 106 fprintf(stdout, "red\n");
@@ -107,6 +112,7 @@ _on_keydown(void *data EINA_UNUSED,
107 g = b = 255; 112 g = b = 255;
108 } 113 }
109 114
115 evas_color_argb_premul(alpha, &r, &g, &b);
110 eo_do(d.clipper, evas_obj_color_set(r, g, b, alpha)); 116 eo_do(d.clipper, evas_obj_color_set(r, g, b, alpha));
111 return; 117 return;
112 } 118 }
diff --git a/src/examples/evas/evas-object-manipulation.c b/src/examples/evas/evas-object-manipulation.c
index 2ecc2b503d..adc031667d 100644
--- a/src/examples/evas/evas-object-manipulation.c
+++ b/src/examples/evas/evas-object-manipulation.c
@@ -70,10 +70,13 @@ _on_keydown(void *data EINA_UNUSED,
70 int alpha, r, g, b; 70 int alpha, r, g, b;
71 71
72 evas_object_color_get(d.clipper, &r, &g, &b, &alpha); 72 evas_object_color_get(d.clipper, &r, &g, &b, &alpha);
73 evas_color_argb_unpremul(alpha, &r, &g, &b);
74
73 alpha -= 20; 75 alpha -= 20;
74 if (alpha < 0) 76 if (alpha < 0)
75 alpha = 255; 77 alpha = 255;
76 78
79 evas_color_argb_premul(alpha, &r, &g, &b);
77 evas_object_color_set(d.clipper, r, g, b, alpha); 80 evas_object_color_set(d.clipper, r, g, b, alpha);
78 81
79 fprintf(stdout, "Changing clipper's opacity: %d%%\n", 82 fprintf(stdout, "Changing clipper's opacity: %d%%\n",
@@ -89,6 +92,8 @@ _on_keydown(void *data EINA_UNUSED,
89 fprintf(stdout, "Changing clipper's color to"); 92 fprintf(stdout, "Changing clipper's color to");
90 93
91 evas_object_color_get(d.clipper, &r, &g, &b, &alpha); 94 evas_object_color_get(d.clipper, &r, &g, &b, &alpha);
95 evas_color_argb_unpremul(alpha, &r, &g, &b);
96
92 if (g > 0) 97 if (g > 0)
93 { 98 {
94 fprintf(stdout, "red\n"); 99 fprintf(stdout, "red\n");
@@ -100,6 +105,7 @@ _on_keydown(void *data EINA_UNUSED,
100 g = b = 255; 105 g = b = 255;
101 } 106 }
102 107
108 evas_color_argb_premul(alpha, &r, &g, &b);
103 evas_object_color_set(d.clipper, r, g, b, alpha); 109 evas_object_color_set(d.clipper, r, g, b, alpha);
104 return; 110 return;
105 } 111 }