From 505593bb98a2509a0d58d2962ad3f27f88cd2696 Mon Sep 17 00:00:00 2001 From: Michal Maciola Date: Tue, 20 Apr 2021 14:29:26 +0200 Subject: [PATCH] evas vg: evas-vg-gradient-manipulation.c added stroke gradient test Added gradient stroke testing in evas-vg-gradient-manipulation.c example Change-Id: Id88d44f9b230ecb4a047b52be9961125b5f1be83 --- src/examples/evas/evas-vg-gradient-manipulation.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/examples/evas/evas-vg-gradient-manipulation.c b/src/examples/evas/evas-vg-gradient-manipulation.c index fd67bbb..d6c9e9b 100644 --- a/src/examples/evas/evas-vg-gradient-manipulation.c +++ b/src/examples/evas/evas-vg-gradient-manipulation.c @@ -17,6 +17,7 @@ struct content Efl_VG *container; Efl_VG *shape; Efl_VG *gradient; + Efl_VG *stroke_gradient; }; static struct content cnt; @@ -39,7 +40,7 @@ _canvas_resize_cb(Ecore_Evas *ee) static void _on_keydown(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, - Evas_Object *o, + Evas_Object *o EINA_UNUSED, void *einfo) { Evas_Event_Key_Down *ei = einfo; @@ -224,12 +225,24 @@ int main(void) evas_vg_gradient_stop_set(cnt.gradient, stops, 2); evas_vg_shape_fill_set(cnt.shape, cnt.gradient); + cnt.stroke_gradient = evas_vg_gradient_linear_add(cnt.container); + evas_vg_gradient_linear_start_set(cnt.stroke_gradient, 540/2, 0); + evas_vg_gradient_linear_end_set(cnt.stroke_gradient, 540/2, 380); + Evas_Vg_Gradient_Stop stroke_stops[] = { + {.offset = 0, .r = 0, .g = 255, .b = 255, .a = 255}, + {.offset = 1, .r = 0, .g = 255, .b = 0, .a = 255} + }; + evas_vg_gradient_stop_set(cnt.stroke_gradient, stroke_stops, 2); + evas_vg_gradient_spread_set(cnt.stroke_gradient, EVAS_VG_GRADIENT_SPREAD_REFLECT); + evas_vg_shape_stroke_fill_set(cnt.shape, cnt.stroke_gradient); + evas_vg_shape_stroke_width_set(cnt.shape, 15); + printf("Evas gradient manipulation example\n"); printf("'a'/'z' to move shape vertically\n"); printf("'s'/'x' to move gradient center vertically\n"); + printf("'d'/'c' to increase/decrease alpha value\n"); printf("'w' to set random gradient center position\n"); printf("'e' to set random gradient colors to semi-transparent (a=128)\n"); - printf("'d'/'c' to increase/decrease alpha value\n"); printf("'r' to restart color stops\n"); printf("'q' to quit\n"); -- 2.7.4