aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/elementary/test_evas_snapshot.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-03-20 19:57:56 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-04-14 11:26:43 +0900
commit513d6866286194cd1e411ca44d8faecf4b48f369 (patch)
treeb2e2ff2aaefefcdf03ad476ac4dc9bfa3042a585 /src/bin/elementary/test_evas_snapshot.c
parentevas: Consider objects in copy mode as opaque (diff)
downloadefl-513d6866286194cd1e411ca44d8faecf4b48f369.tar.gz
elm_test: Add slider to control blur radius
Diffstat (limited to 'src/bin/elementary/test_evas_snapshot.c')
-rw-r--r--src/bin/elementary/test_evas_snapshot.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/bin/elementary/test_evas_snapshot.c b/src/bin/elementary/test_evas_snapshot.c
index d2e87862b3..94d6e160be 100644
--- a/src/bin/elementary/test_evas_snapshot.c
+++ b/src/bin/elementary/test_evas_snapshot.c
@@ -21,7 +21,7 @@ static const int rnd[] = {
static const char *filter =
"padding_set {0}"
"fill { color = 'red' }"
- "blur { 5 }"
+ "blur { radius }"
"print ('Evaluating filter: ' .. input.width .. 'x' .. input.height)"
;
@@ -54,6 +54,18 @@ _anim_toggle(void *data, const Efl_Event *ev EINA_UNUSED)
}
static void
+_radius_set(void *data, const Efl_Event *ev)
+{
+ char buf[128];
+ Eo *win = data;
+ Eo *snap;
+
+ snap = efl_key_wref_get(win, "snap");
+ sprintf(buf, "tonumber(%d)", (int) elm_slider_value_get(ev->object));
+ efl_gfx_filter_data_set(snap, "radius", buf, EINA_TRUE);
+}
+
+static void
_close(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *win = data;
@@ -93,6 +105,7 @@ test_evas_snapshot(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
// Snapshot
snap = efl_add(EFL_CANVAS_SNAPSHOT_CLASS, win,
efl_gfx_filter_program_set(efl_added, filter, "filter"),
+ efl_gfx_filter_data_set(efl_added, "radius", "tonumber(5)", EINA_TRUE),
efl_gfx_size_hint_align_set(efl_added, -1.0, -1.0),
efl_gfx_size_hint_weight_set(efl_added, 1.0, 1.0),
efl_pack_grid(grid, efl_added, 1, 1, GRID_SIZE - 2, GRID_SIZE - 2),
@@ -118,11 +131,22 @@ test_evas_snapshot(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
efl_pack_grid(grid, o, 0, 0, GRID_SIZE, GRID_SIZE);
// Controls
+ efl_add(ELM_SLIDER_CLASS, win,
+ elm_object_text_set(efl_added, "Blur radius: "),
+ elm_slider_min_max_set(efl_added, 0, 64),
+ elm_slider_value_set(efl_added, 5),
+ elm_slider_unit_format_set(efl_added, "%.0f px"),
+ efl_gfx_size_hint_align_set(efl_added, -1.0, -1.0),
+ efl_gfx_size_hint_weight_set(efl_added, 1.0, 0.0),
+ efl_pack_grid(grid, efl_added, 0, GRID_SIZE, GRID_SIZE, 1),
+ efl_event_callback_add(efl_added, ELM_SLIDER_EVENT_CHANGED, _radius_set, win),
+ efl_gfx_visible_set(efl_added, 1));
+
efl_add(ELM_BUTTON_CLASS, win,
efl_text_set(efl_added, "Toggle animation"),
efl_gfx_size_hint_align_set(efl_added, -1.0, -1.0),
efl_gfx_size_hint_weight_set(efl_added, 1.0, 0.0),
- efl_pack_grid(grid, efl_added, 0, GRID_SIZE, (GRID_SIZE + 1) / 2, 1),
+ efl_pack_grid(grid, efl_added, 0, GRID_SIZE + 1, (GRID_SIZE + 1) / 2, 1),
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _anim_toggle, win),
efl_gfx_visible_set(efl_added, 1));
@@ -130,7 +154,7 @@ test_evas_snapshot(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
efl_text_set(efl_added, "Close"),
efl_gfx_size_hint_align_set(efl_added, -1.0, -1.0),
efl_gfx_size_hint_weight_set(efl_added, 1.0, 0.0),
- efl_pack_grid(grid, efl_added, (GRID_SIZE + 1) / 2, GRID_SIZE, (GRID_SIZE + 1) / 2, 1),
+ efl_pack_grid(grid, efl_added, (GRID_SIZE + 1) / 2, GRID_SIZE + 1, (GRID_SIZE + 1) / 2, 1),
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _close, win),
efl_gfx_visible_set(efl_added, 1));