summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Nash <nash@nash.id.au>2011-05-01 06:39:31 +0000
committerBrett Nash <nash@nash.id.au>2011-05-01 06:39:31 +0000
commitd9d9ca82d1e460ca9c3cdd88777c77465d4c7231 (patch)
tree3996fc66b2f2cb93d8bc5438b8a95019eb5161bd
parent6ddaefaaf6b4d1658d9b945389439dd5e3063ae3 (diff)
Add brightness tests.
SVN revision: 59069
-rw-r--r--src/bin/Makefile.am2
-rw-r--r--src/bin/filter_object_brightness.c109
-rw-r--r--src/bin/filter_object_brightness_solid.c111
-rw-r--r--src/bin/tests.h2
-rw-r--r--src/bin/ui.c14
5 files changed, 232 insertions, 6 deletions
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index d849743..5c76775 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -136,6 +136,8 @@ filter_object_greyscale.c \
136filter_object_greyscale_solid.c \ 136filter_object_greyscale_solid.c \
137filter_object_invert.c \ 137filter_object_invert.c \
138filter_object_invert_solid.c \ 138filter_object_invert_solid.c \
139filter_object_brightness.c \
140filter_object_brightness_solid.c \
139filter_object_blur.c \ 141filter_object_blur.c \
140filter_object_blur_solid.c 142filter_object_blur_solid.c
141 143
diff --git a/src/bin/filter_object_brightness.c b/src/bin/filter_object_brightness.c
new file mode 100644
index 0000000..a1d5ef6
--- /dev/null
+++ b/src/bin/filter_object_brightness.c
@@ -0,0 +1,109 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4
5/* metadata */
6#define FNAME filter_object_brightness
7#define NAME "Filter Object Brightness"
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,*src;
24
25 for (i = 0; i < OBNUM; i++)
26 {
27 o = evas_object_image_add(evas);
28 evas_object_image_file_set(o, build_path("logo.png"), NULL);
29 evas_object_image_fill_set(o, 0, 0, 120, 160);
30 evas_object_resize(o, 120, 160);
31 evas_object_filter_set(o, EVAS_FILTER_BRIGHTNESS);
32 evas_object_filter_param_float_set(o, "adjust", i / (double)OBNUM);
33 evas_object_show(o);
34 src = o;
35 o_images[i] = src;
36 }
37
38 done = 0;
39}
40
41/* cleanup */
42static void _cleanup(void)
43{
44 int i;
45 for (i = 0; i < OBNUM; i++) evas_object_del(o_images[i]);
46}
47
48/* loop - do things */
49static void _loop(double t, int f)
50{
51 int i;
52 Evas_Coord x, y, w, h;
53 for (i = 0; i < OBNUM; i++)
54 {
55 w = 120;
56 h = 160;
57 x = (win_w / 2) - (w / 2);
58 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
59 y = (win_h / 2) - (h / 2);
60 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);
61 evas_object_move(o_images[i], x, y);
62 evas_object_filter_param_float_set(o_images[i], "adjust",
63 ((i + f) % OBNUM) / (2.0 * OBNUM) - 1);
64 }
65 FPS_STD(NAME);
66}
67
68/* prepend special key handlers if interactive (before STD) */
69static void _key(char *key)
70{
71 KEY_STD;
72}
73
74
75
76
77
78
79
80
81
82
83
84
85/* template stuff - ignore */
86# endif
87#endif
88
89#ifdef UI
90_ui_menu_item_add(ICON, NAME, FNAME);
91#endif
92
93#ifdef PROTO
94void FNAME(void);
95#endif
96
97#ifndef PROTO
98# ifndef UI
99void FNAME(void)
100{
101 ui_func_set(_key, _loop);
102 _setup();
103}
104# endif
105#endif
106#undef FNAME
107#undef NAME
108#undef ICON
109
diff --git a/src/bin/filter_object_brightness_solid.c b/src/bin/filter_object_brightness_solid.c
new file mode 100644
index 0000000..849482e
--- /dev/null
+++ b/src/bin/filter_object_brightness_solid.c
@@ -0,0 +1,111 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4
5/* metadata */
6#define FNAME filter_object_brightness_solid
7#define NAME "Filter Object Brightness Solid"
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,*src;
24
25 for (i = 0; i < OBNUM; i++)
26 {
27 o = evas_object_image_add(evas);
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_filter_set(o, EVAS_FILTER_BRIGHTNESS);
32 evas_object_filter_param_float_set(o, "adjust",
33 i / (2.0 * OBNUM) - 1.0);
34 evas_object_layer_set(o,1);
35 evas_object_show(o);
36 src = o;
37 o_images[i] = src;
38 }
39
40 done = 0;
41}
42
43/* cleanup */
44static void _cleanup(void)
45{
46 int i;
47 for (i = 0; i < OBNUM; i++) evas_object_del(o_images[i]);
48}
49
50/* loop - do things */
51static void _loop(double t, int f)
52{
53 int i;
54 Evas_Coord x, y, w, h;
55 for (i = 0; i < OBNUM; i++)
56 {
57 w = 120;
58 h = 160;
59 x = (win_w / 2) - (w / 2);
60 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
61 y = (win_h / 2) - (h / 2);
62 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);
63 evas_object_move(o_images[i], x, y);
64 evas_object_filter_param_float_set(o_images[i], "adjust",
65 (((i + f) % OBNUM) * 2.0) / (OBNUM) - 1.0);
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
111
diff --git a/src/bin/tests.h b/src/bin/tests.h
index c500640..706f44c 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -110,6 +110,8 @@
110#include "filter_object_invert_solid.c" 110#include "filter_object_invert_solid.c"
111#include "filter_object_greyscale.c" 111#include "filter_object_greyscale.c"
112#include "filter_object_greyscale_solid.c" 112#include "filter_object_greyscale_solid.c"
113#include "filter_object_brightness.c"
114#include "filter_object_brightness_solid.c"
113#include "filter_object_sepia.c" 115#include "filter_object_sepia.c"
114#include "filter_object_sepia_solid.c" 116#include "filter_object_sepia_solid.c"
115#include "filter_object_blur.c" 117#include "filter_object_blur.c"
diff --git a/src/bin/ui.c b/src/bin/ui.c
index 91904ca..7b2eef2 100644
--- a/src/bin/ui.c
+++ b/src/bin/ui.c
@@ -182,15 +182,17 @@ static double weights[] =
182 1.000, 182 1.000,
183 2.000, 183 2.000,
184 1.000, 184 1.000,
185 2.000, 185 2.000,
186 186
187 1.000, // test 111 187 1.000, // test 111
188 2.000, 188 2.000,
189 1.000, 189 1.000,
190 2.000, 190 2.000,
191 10.000, 191 1.000,
192 192
193 10.000, // test 116 193 2.000, // test 116
194 10.000,
195 10.000,
194 196
195 0.0, // Exit 197 0.0, // Exit
196 198