summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2019-07-09 14:21:19 +0900
committerHermet Park <hermetpark@gmail.com>2019-07-09 14:21:20 +0900
commit228b91e36f1cb9105b9f628b85d751086a9ef70f (patch)
tree226e1c5e543f62742c57c2241401c0e822f6640a
parentc8827c0dccff99db8aff2c0eb35a73614db296f6 (diff)
efl_gfx_shape: Stroke color use a premultiplied color.
Summary: R, G, and B must not be higher than alpha. Test Plan: //test code Ecore_Evas *ee = ecore_evas_new(NULL, 0, 0, 600, 600, NULL); ecore_evas_show(ee); Evas *evas = ecore_evas_get(ee); Evas_Object *vg,*bg; bg = evas_object_rectangle_add(evas); evas_object_color_set(bg, 0, 0, 255, 255); evas_object_focus_set(bg, 1); evas_object_show(bg); int w, h; ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); evas_object_resize(bg, w, h); vg = evas_object_vg_add(evas); evas_object_focus_set(vg, 1); evas_object_show(vg); evas_object_resize(vg, w, h); Efl_VG *shape, *container; container = evas_vg_container_add(vg); shape = evas_vg_shape_add(container); evas_vg_shape_append_rect(shape, 0, 0, 200 , 200, 10, 10); evas_vg_shape_stroke_color_set(shape, 255, 255, 255, 10); evas_vg_shape_stroke_width_set(shape, 20); evas_vg_node_origin_set(shape, 200, 200); evas_object_vg_root_node_set(vg, container); ecore_main_loop_begin(); ecore_evas_shutdown(); Reviewers: Hermet, smohanty, kimcinoo Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9217
-rw-r--r--src/lib/efl/interfaces/efl_gfx_shape.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c
index f5ebdab18e..fa3b718e1b 100644
--- a/src/lib/efl/interfaces/efl_gfx_shape.c
+++ b/src/lib/efl/interfaces/efl_gfx_shape.c
@@ -8,6 +8,8 @@
8 8
9#include <Efl.h> 9#include <Efl.h>
10 10
11#define ERR(...) EINA_LOG_DOM_ERR(EINA_LOG_DOMAIN_DEFAULT, __VA_ARGS__)
12
11#define MY_CLASS EFL_GFX_SHAPE_MIXIN 13#define MY_CLASS EFL_GFX_SHAPE_MIXIN
12 14
13typedef struct _Efl_Gfx_Shape_Data 15typedef struct _Efl_Gfx_Shape_Data
@@ -142,6 +144,17 @@ EOLIAN static void
142_efl_gfx_shape_stroke_color_set(Eo *obj EINA_UNUSED, Efl_Gfx_Shape_Data *pd, 144_efl_gfx_shape_stroke_color_set(Eo *obj EINA_UNUSED, Efl_Gfx_Shape_Data *pd,
143 int r, int g, int b, int a) 145 int r, int g, int b, int a)
144{ 146{
147 Eina_Bool err = EINA_FALSE;
148 if (a > 255) { a = 255; err = EINA_TRUE; }
149 if (a < 0) { a = 0; err = EINA_TRUE; }
150 if (r > a) { r = a; err = EINA_TRUE; }
151 if (r < 0) { r = 0; err = EINA_TRUE; }
152 if (g > a) { g = a; err = EINA_TRUE; }
153 if (g < 0) { g = 0; err = EINA_TRUE; }
154 if (b > a) { b = a; err = EINA_TRUE; }
155 if (b < 0) { b = 0; err = EINA_TRUE; }
156 if (err)
157 ERR("Only handles premultiplied colors (0 <= R,G,B <= A <= 255)");
145 pd->public.stroke.color.r = r; 158 pd->public.stroke.color.r = r;
146 pd->public.stroke.color.g = g; 159 pd->public.stroke.color.g = g;
147 pd->public.stroke.color.b = b; 160 pd->public.stroke.color.b = b;