summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Nash <nash@nash.id.au>2011-04-19 06:09:31 +0000
committerBrett Nash <nash@nash.id.au>2011-04-19 06:09:31 +0000
commit758cbafbda5c48d30c2b105b9d0c1b26e93d9a9a (patch)
tree979327c7bd8a52908abfe42b15807b2e9393549a
parent2a6efe355bc53dd1ee94775966ede8518ac35afe (diff)
Expedite: Add image mask test.
SVN revision: 58727
-rw-r--r--src/bin/Makefile.am3
-rw-r--r--src/bin/image_mask.c110
-rw-r--r--src/bin/proxy_image_offscreen.c114
-rw-r--r--src/bin/tests.h1
4 files changed, 227 insertions, 1 deletions
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index ea9bbab..d29a49e 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -112,7 +112,8 @@ image_blend_occlude3_very_many.c \
112poly_blend.c \ 112poly_blend.c \
113proxy_image.c \ 113proxy_image.c \
114proxy_text_fixed.c \ 114proxy_text_fixed.c \
115proxy_text_random.c 115proxy_text_random.c \
116image_mask.c
116 117
117expedite_CFLAGS = @WIN32_CFLAGS@ 118expedite_CFLAGS = @WIN32_CFLAGS@
118expedite_CXXFLAGS = @EXPEDITE_CXXFLAGS@ 119expedite_CXXFLAGS = @EXPEDITE_CXXFLAGS@
diff --git a/src/bin/image_mask.c b/src/bin/image_mask.c
new file mode 100644
index 0000000..3677990
--- /dev/null
+++ b/src/bin/image_mask.c
@@ -0,0 +1,110 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4
5/* metadata */
6#define FNAME image_mask
7#define NAME "Image Mask"
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+= 2)
25 {
26 o = evas_object_image_add(evas);
27 o_images[i] = o;
28 evas_object_image_file_set(o, build_path("image.png"), NULL);
29 evas_object_image_fill_set(o, 0, 0, 120, 160);
30 evas_object_resize(o, 120, 160);
31 evas_object_show(o);
32
33 o = evas_object_image_add(evas);
34 o_images[i + 1] = o;
35 evas_object_image_file_set(o, build_path("e-logo.png"), NULL);
36 evas_object_image_fill_set(o, 0, 0, 120, 160);
37 evas_object_resize(o, 120, 160);
38 evas_object_show(o);
39 evas_object_clip_set(o_images[i],o);
40 }
41 done = 0;
42}
43
44/* cleanup */
45static void _cleanup(void)
46{
47 int i;
48 for (i = 0; i < OBNUM; i++) evas_object_del(o_images[i]);
49}
50
51/* loop - do things */
52static void _loop(double t, int f)
53{
54 int i;
55 Evas_Coord x, y, w, h;
56 for (i = 0; i < OBNUM; i+= 2)
57 {
58 w = 120;
59 h = 160;
60 x = (win_w / 2) - (w / 2);
61 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
62 y = (win_h / 2) - (h / 2);
63 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);
64 evas_object_move(o_images[i], x, y);
65 evas_object_move(o_images[i + 1], x, y);
66 }
67 FPS_STD(NAME);
68}
69
70/* prepend special key handlers if interactive (before STD) */
71static void _key(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/proxy_image_offscreen.c b/src/bin/proxy_image_offscreen.c
new file mode 100644
index 0000000..b147142
--- /dev/null
+++ b/src/bin/proxy_image_offscreen.c
@@ -0,0 +1,114 @@
1/**
2 * This tests that proxy works fine if the proxy (of an image) works when
3 * offscreen.
4 */
5#undef FNAME
6#undef NAME
7#undef ICON
8
9/* metadata */
10#define FNAME image_blend_unscaled_proxy_start
11#define NAME "Proxy Offscreen"
12#define ICON "blend.png"
13
14#ifndef PROTO
15# ifndef UI
16# include "main.h"
17
18/* standard var */
19static int done = 0;
20/* private data */
21static Evas_Object *o_images[OBNUM];
22
23/* setup */
24static void _setup(void)
25{
26 int i;
27 Evas_Object *o,*src;
28
29 o = evas_object_image_add(evas);
30 evas_object_image_file_set(o, build_path("logo.png"), NULL);
31 evas_object_image_fill_set(o, 0, 0, 120, 160);
32 evas_object_resize(o, 120, 160);
33 evas_object_move(o, -400, -300);
34 src = o;
35
36 for (i = 0; i < OBNUM / 2; i++)
37 {
38 o = evas_object_image_add(evas);
39 o_images[i] = o;
40 evas_object_image_source_set(o, src);
41 evas_object_resize(o, 120, 160);
42 evas_object_image_fill_set(o, 0,0,120,160);
43 evas_object_show(o);
44 }
45 done = 0;
46}
47
48/* cleanup */
49static void _cleanup(void)
50{
51 int i;
52 for (i = 0; i < OBNUM; i++) evas_object_del(o_images[i]);
53}
54
55/* loop - do things */
56static void _loop(double t, int f)
57{
58 int i;
59 Evas_Coord x, y, w, h;
60 for (i = 0; i < OBNUM; i++)
61 {
62 w = 120;
63 h = 160;
64 x = (win_w / 2) - (w / 2);
65 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
66 y = (win_h / 2) - (h / 2);
67 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);
68 evas_object_move(o_images[i], x, y);
69 }
70 FPS_STD(NAME);
71}
72
73/* prepend special key handlers if interactive (before STD) */
74static void _key(char *key)
75{
76 KEY_STD;
77}
78
79
80
81
82
83
84
85
86
87
88
89
90/* template stuff - ignore */
91# endif
92#endif
93
94#ifdef UI
95_ui_menu_item_add(ICON, NAME, FNAME);
96#endif
97
98#ifdef PROTO
99void FNAME(void);
100#endif
101
102#ifndef PROTO
103# ifndef UI
104void FNAME(void)
105{
106 ui_func_set(_key, _loop);
107 _setup();
108}
109# endif
110#endif
111#undef FNAME
112#undef NAME
113#undef ICON
114
diff --git a/src/bin/tests.h b/src/bin/tests.h
index 202db87..e5ec127 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -89,3 +89,4 @@
89#include "proxy_image.c" 89#include "proxy_image.c"
90#include "proxy_text_fixed.c" 90#include "proxy_text_fixed.c"
91#include "proxy_text_random.c" 91#include "proxy_text_random.c"
92#include "image_mask.c"