Add brightness tests.

SVN revision: 59069
This commit is contained in:
Brett Nash 2011-05-01 06:39:31 +00:00
parent 6ddaefaaf6
commit d9d9ca82d1
5 changed files with 232 additions and 6 deletions

View File

@ -136,6 +136,8 @@ filter_object_greyscale.c \
filter_object_greyscale_solid.c \
filter_object_invert.c \
filter_object_invert_solid.c \
filter_object_brightness.c \
filter_object_brightness_solid.c \
filter_object_blur.c \
filter_object_blur_solid.c

View File

@ -0,0 +1,109 @@
#undef FNAME
#undef NAME
#undef ICON
/* metadata */
#define FNAME filter_object_brightness
#define NAME "Filter Object Brightness"
#define ICON "blend.png"
#ifndef PROTO
# ifndef UI
# include "main.h"
/* standard var */
static int done = 0;
/* private data */
static Evas_Object *o_images[OBNUM];
/* setup */
static void _setup(void)
{
int i;
Evas_Object *o,*src;
for (i = 0; i < OBNUM; i++)
{
o = evas_object_image_add(evas);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
evas_object_image_fill_set(o, 0, 0, 120, 160);
evas_object_resize(o, 120, 160);
evas_object_filter_set(o, EVAS_FILTER_BRIGHTNESS);
evas_object_filter_param_float_set(o, "adjust", i / (double)OBNUM);
evas_object_show(o);
src = o;
o_images[i] = src;
}
done = 0;
}
/* cleanup */
static void _cleanup(void)
{
int i;
for (i = 0; i < OBNUM; i++) evas_object_del(o_images[i]);
}
/* loop - do things */
static void _loop(double t, int f)
{
int i;
Evas_Coord x, y, w, h;
for (i = 0; i < OBNUM; i++)
{
w = 120;
h = 160;
x = (win_w / 2) - (w / 2);
x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
y = (win_h / 2) - (h / 2);
y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);
evas_object_move(o_images[i], x, y);
evas_object_filter_param_float_set(o_images[i], "adjust",
((i + f) % OBNUM) / (2.0 * OBNUM) - 1);
}
FPS_STD(NAME);
}
/* prepend special key handlers if interactive (before STD) */
static void _key(char *key)
{
KEY_STD;
}
/* template stuff - ignore */
# endif
#endif
#ifdef UI
_ui_menu_item_add(ICON, NAME, FNAME);
#endif
#ifdef PROTO
void FNAME(void);
#endif
#ifndef PROTO
# ifndef UI
void FNAME(void)
{
ui_func_set(_key, _loop);
_setup();
}
# endif
#endif
#undef FNAME
#undef NAME
#undef ICON

View File

@ -0,0 +1,111 @@
#undef FNAME
#undef NAME
#undef ICON
/* metadata */
#define FNAME filter_object_brightness_solid
#define NAME "Filter Object Brightness Solid"
#define ICON "blend.png"
#ifndef PROTO
# ifndef UI
# include "main.h"
/* standard var */
static int done = 0;
/* private data */
static Evas_Object *o_images[OBNUM];
/* setup */
static void _setup(void)
{
int i;
Evas_Object *o,*src;
for (i = 0; i < OBNUM; i++)
{
o = evas_object_image_add(evas);
evas_object_image_file_set(o, build_path("image.png"), NULL);
evas_object_image_fill_set(o, 0, 0, 120, 160);
evas_object_resize(o, 120, 160);
evas_object_filter_set(o, EVAS_FILTER_BRIGHTNESS);
evas_object_filter_param_float_set(o, "adjust",
i / (2.0 * OBNUM) - 1.0);
evas_object_layer_set(o,1);
evas_object_show(o);
src = o;
o_images[i] = src;
}
done = 0;
}
/* cleanup */
static void _cleanup(void)
{
int i;
for (i = 0; i < OBNUM; i++) evas_object_del(o_images[i]);
}
/* loop - do things */
static void _loop(double t, int f)
{
int i;
Evas_Coord x, y, w, h;
for (i = 0; i < OBNUM; i++)
{
w = 120;
h = 160;
x = (win_w / 2) - (w / 2);
x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
y = (win_h / 2) - (h / 2);
y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);
evas_object_move(o_images[i], x, y);
evas_object_filter_param_float_set(o_images[i], "adjust",
(((i + f) % OBNUM) * 2.0) / (OBNUM) - 1.0);
}
FPS_STD(NAME);
}
/* prepend special key handlers if interactive (before STD) */
static void _key(char *key)
{
KEY_STD;
}
/* template stuff - ignore */
# endif
#endif
#ifdef UI
_ui_menu_item_add(ICON, NAME, FNAME);
#endif
#ifdef PROTO
void FNAME(void);
#endif
#ifndef PROTO
# ifndef UI
void FNAME(void)
{
ui_func_set(_key, _loop);
_setup();
}
# endif
#endif
#undef FNAME
#undef NAME
#undef ICON

View File

@ -110,6 +110,8 @@
#include "filter_object_invert_solid.c"
#include "filter_object_greyscale.c"
#include "filter_object_greyscale_solid.c"
#include "filter_object_brightness.c"
#include "filter_object_brightness_solid.c"
#include "filter_object_sepia.c"
#include "filter_object_sepia_solid.c"
#include "filter_object_blur.c"

View File

@ -188,9 +188,11 @@ static double weights[] =
2.000,
1.000,
2.000,
10.000,
1.000,
10.000, // test 116
2.000, // test 116
10.000,
10.000,
0.0, // Exit