summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@ddlm.me>2019-05-08 17:53:54 -0700
committerCedric BAIL <cedric@ddlm.me>2019-08-09 11:03:42 -0700
commit6c2c96b622b3c7aa54d5f4de54dff057fe5f29e3 (patch)
tree11d06a59745e40eded93001d9fa573a149d8f555
parentba687d4b20050c8233ee7a84ec0a2a213186d769 (diff)
add new test for stretchable zone support on image object.
-rw-r--r--data/meson.build1
-rw-r--r--data/stretch.pngbin0 -> 3972 bytes
-rw-r--r--src/bin/image_blend_solid_stretch.c110
-rw-r--r--src/bin/meson.build1
-rw-r--r--src/bin/tests.h1
5 files changed, 113 insertions, 0 deletions
diff --git a/data/meson.build b/data/meson.build
index 30925f9..c4daa22 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -17,6 +17,7 @@ files = [ 'Kochi.ttf',
17 'image.png', 17 'image.png',
18 'bar.png', 18 'bar.png',
19 'frame.png', 19 'frame.png',
20 'stretch.png',
20 'pan.png', 21 'pan.png',
21 'tp.png', 22 'tp.png',
22 'tp.yuv', 23 'tp.yuv',
diff --git a/data/stretch.png b/data/stretch.png
new file mode 100644
index 0000000..7a420a1
--- /dev/null
+++ b/data/stretch.png
Binary files differ
diff --git a/src/bin/image_blend_solid_stretch.c b/src/bin/image_blend_solid_stretch.c
new file mode 100644
index 0000000..2d7c0d4
--- /dev/null
+++ b/src/bin/image_blend_solid_stretch.c
@@ -0,0 +1,110 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4
5/* metadata */
6#define FNAME image_blend_solid_stretch_start
7#define NAME "Image Blend Solid Stretch"
8#define ICON "blend.png"
9
10#ifndef PROTO
11# ifndef UI
12# include "main.h"
13
14/* standard var */
15static int done = 0;
16/* private data */
17static Evas_Object *o_images[OBNUM];
18
19// Each offset is relative to the last block
20static const Efl_Gfx_Image_Stretch_Region hsz[] = { { 8, 8 }, { 16, 55 } };
21static const Efl_Gfx_Image_Stretch_Region vsz[] = { { 8, 8 }, { 16, 12 } };
22
23/* setup */
24static void _setup(void)
25{
26 int i;
27 Evas_Object *o;
28 for (i = 0; i < OBNUM; i++)
29 {
30 o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
31 o_images[i] = o;
32 efl_file_simple_load(o, build_path("stretch.png"), NULL);
33 efl_gfx_image_stretch_region_set(o, EINA_C_ARRAY_ITERATOR_NEW(hsz),
34 EINA_C_ARRAY_ITERATOR_NEW(vsz));
35 efl_gfx_entity_visible_set(o, EINA_TRUE);
36 }
37 done = 0;
38}
39
40/* cleanup */
41static void _cleanup(void)
42{
43 int i;
44 for (i = 0; i < OBNUM; i++) efl_del(o_images[i]);
45}
46
47/* loop - do things */
48static void _loop(double t, int f)
49{
50 int i;
51 Evas_Coord x, y, w, h, w0, h0;
52 static int done = 0;
53 for (i = 0; i < OBNUM; i++)
54 {
55 w0 = 80;
56 h0 = 80;
57 w = 5 + ((1.0 + cos((double)(f + (i * 10)) / (7.4 * SLOW))) * w0 * 2);
58 h = 5 + ((1.0 + sin((double)(f + (i * 19)) / (12.6 * SLOW))) * w0 * 2);
59 x = (win_w / 2) - (w / 2);
60 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w0 / 2);
61 y = (win_h / 2) - (h / 2);
62 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h0 / 2);
63 efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
64 efl_gfx_entity_size_set(o_images[i], EINA_SIZE2D(w, h));
65 efl_gfx_fill_set(o_images[i], EINA_RECT(0, 0, w, h));
66 }
67 FPS_STD(NAME);
68}
69
70/* prepend special key handlers if interactive (before STD) */
71static void _key(const char *key)
72{
73 KEY_STD;
74}
75
76
77
78
79
80
81
82
83
84
85
86
87/* template stuff - ignore */
88# endif
89#endif
90
91#ifdef UI
92_ui_menu_item_add(ICON, NAME, FNAME);
93#endif
94
95#ifdef PROTO
96void FNAME(void);
97#endif
98
99#ifndef PROTO
100# ifndef UI
101void FNAME(void)
102{
103 ui_func_set(_key, _loop);
104 _setup();
105}
106# endif
107#endif
108#undef FNAME
109#undef NAME
110#undef ICON
diff --git a/src/bin/meson.build b/src/bin/meson.build
index 73a4724..658e558 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -38,6 +38,7 @@ expedite_sources = [ 'main.c',
38 'image_blend_border.c', 38 'image_blend_border.c',
39 'image_blend_solid_middle_border.c', 39 'image_blend_solid_middle_border.c',
40 'image_blend_solid_border.c', 40 'image_blend_solid_border.c',
41 'image_blend_solid_stretch.c',
41 'image_blend_border_recolor.c', 42 'image_blend_border_recolor.c',
42 'image_map_rotate.c', 43 'image_map_rotate.c',
43 'image_map_solid_rotate.c', 44 'image_map_solid_rotate.c',
diff --git a/src/bin/tests.h b/src/bin/tests.h
index 18833de..655ac84 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -31,6 +31,7 @@
31#include "image_blend_border.c" 31#include "image_blend_border.c"
32#include "image_blend_solid_middle_border.c" 32#include "image_blend_solid_middle_border.c"
33#include "image_blend_solid_border.c" 33#include "image_blend_solid_border.c"
34#include "image_blend_solid_stretch.c"
34#include "image_blend_border_recolor.c" 35#include "image_blend_border_recolor.c"
35#include "image_map_rotate.c" 36#include "image_map_rotate.c"
36#include "image_map_solid_rotate.c" 37#include "image_map_solid_rotate.c"