summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@ddlm.me>2019-06-13 15:15:50 -0700
committerCedric BAIL <cedric@ddlm.me>2019-08-09 11:03:42 -0700
commit4e6dd92826dc4200953f507645eeb00b065774ed (patch)
tree3c8522b6ca045c80852e6d9f905dd37489947527
parent6c2c96b622b3c7aa54d5f4de54dff057fe5f29e3 (diff)
add new test for 9patch files.
-rw-r--r--data/9patch_test.9.pngbin0 -> 9821 bytes
-rw-r--r--data/meson.build1
-rw-r--r--src/bin/image_blend_solid_9patch.c104
-rw-r--r--src/bin/meson.build1
-rw-r--r--src/bin/tests.h1
5 files changed, 107 insertions, 0 deletions
diff --git a/data/9patch_test.9.png b/data/9patch_test.9.png
new file mode 100644
index 0000000..7e579d2
--- /dev/null
+++ b/data/9patch_test.9.png
Binary files differ
diff --git a/data/meson.build b/data/meson.build
index c4daa22..8c0f66d 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -18,6 +18,7 @@ files = [ 'Kochi.ttf',
18 'bar.png', 18 'bar.png',
19 'frame.png', 19 'frame.png',
20 'stretch.png', 20 'stretch.png',
21 '9patch_test.9.png',
21 'pan.png', 22 'pan.png',
22 'tp.png', 23 'tp.png',
23 'tp.yuv', 24 'tp.yuv',
diff --git a/src/bin/image_blend_solid_9patch.c b/src/bin/image_blend_solid_9patch.c
new file mode 100644
index 0000000..81c9de4
--- /dev/null
+++ b/src/bin/image_blend_solid_9patch.c
@@ -0,0 +1,104 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4
5/* metadata */
6#define FNAME image_blend_solid_9patch_start
7#define NAME "Image Blend Solid 9patch"
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/* setup */
20static void _setup(void)
21{
22 int i;
23 Evas_Object *o;
24 for (i = 0; i < OBNUM; i++)
25 {
26 o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
27 o_images[i] = o;
28 efl_file_simple_load(o, build_path("9patch_test.9.png"), NULL);
29 efl_gfx_entity_visible_set(o, EINA_TRUE);
30 }
31 done = 0;
32}
33
34/* cleanup */
35static void _cleanup(void)
36{
37 int i;
38 for (i = 0; i < OBNUM; i++) efl_del(o_images[i]);
39}
40
41/* loop - do things */
42static void _loop(double t, int f)
43{
44 int i;
45 Evas_Coord x, y, w, h, w0, h0;
46 static int done = 0;
47 for (i = 0; i < OBNUM; i++)
48 {
49 w0 = 80;
50 h0 = 80;
51 w = 5 + ((1.0 + cos((double)(f + (i * 10)) / (7.4 * SLOW))) * w0 * 2);
52 h = 5 + ((1.0 + sin((double)(f + (i * 19)) / (12.6 * SLOW))) * w0 * 2);
53 x = (win_w / 2) - (w / 2);
54 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w0 / 2);
55 y = (win_h / 2) - (h / 2);
56 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h0 / 2);
57 efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
58 efl_gfx_entity_size_set(o_images[i], EINA_SIZE2D(w, h));
59 efl_gfx_fill_set(o_images[i], EINA_RECT(0, 0, w, h));
60 }
61 FPS_STD(NAME);
62}
63
64/* prepend special key handlers if interactive (before STD) */
65static void _key(const char *key)
66{
67 KEY_STD;
68}
69
70
71
72
73
74
75
76
77
78
79
80
81/* template stuff - ignore */
82# endif
83#endif
84
85#ifdef UI
86_ui_menu_item_add(ICON, NAME, FNAME);
87#endif
88
89#ifdef PROTO
90void FNAME(void);
91#endif
92
93#ifndef PROTO
94# ifndef UI
95void FNAME(void)
96{
97 ui_func_set(_key, _loop);
98 _setup();
99}
100# endif
101#endif
102#undef FNAME
103#undef NAME
104#undef ICON
diff --git a/src/bin/meson.build b/src/bin/meson.build
index 658e558..b68f600 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -39,6 +39,7 @@ expedite_sources = [ 'main.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_solid_stretch.c',
42 'image_blend_solid_9patch.c',
42 'image_blend_border_recolor.c', 43 'image_blend_border_recolor.c',
43 'image_map_rotate.c', 44 'image_map_rotate.c',
44 'image_map_solid_rotate.c', 45 'image_map_solid_rotate.c',
diff --git a/src/bin/tests.h b/src/bin/tests.h
index 655ac84..a3fdb1c 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -32,6 +32,7 @@
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_solid_stretch.c"
35#include "image_blend_solid_9patch.c"
35#include "image_blend_border_recolor.c" 36#include "image_blend_border_recolor.c"
36#include "image_map_rotate.c" 37#include "image_map_rotate.c"
37#include "image_map_solid_rotate.c" 38#include "image_map_solid_rotate.c"