#ifdef HAVE_CONFIG_H
#include "config.h"
#else
#define PACKAGE_EXAMPLES_DIR "."
#endif
#include <Ecore.h>
#include <stdio.h>
#include <errno.h>
#include "evas-common.h"
#define WIDTH (320)
#define HEIGHT (240)
static const char *img_path = PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/enlightenment.png";
static const char *border_img_path = PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/red.png";
struct test_data
{
Ecore_Evas *ee;
Evas_Object *img, *bg, *clipper, *clipper_border, *text;
};
static struct test_data d = {0};
static void
_canvas_resize_cb(Ecore_Evas *ee)
{
int w, h;
evas_object_resize(d.bg, w, h);
}
static void
void *einfo)
{
if (strcmp(ev->
key,
"h") == 0)
{
printf("commands are:\n"
"\to - change clipper's opacity\n"
"\tr - toggle clipper's color between red and white\n"
"\tc - toggle clipper's clipping function\n"
"\tv - toggle clipper's visibility\n");
return;
}
if (strcmp(ev->
key,
"o") == 0)
{
int alpha, r, g, b;
alpha -= 20;
if (alpha < 0)
alpha = 255;
printf("Changing clipper's opacity: %d%%\n",
(int)((alpha / 255.0) * 100));
return;
}
if (strcmp(ev->
key,
"r") == 0)
{
int alpha, r, g, b;
printf("Changing clipper's color to");
if (g > 0)
{
printf("red\n");
g = b = 0;
}
else
{
printf("white\n");
g = b = 255;
}
return;
}
if (strcmp(ev->
key,
"c") == 0)
{
printf("Toggling clipping ");
if (evas_object_clip_get(d.img) == d.clipper)
{
evas_object_clip_unset(d.img);
printf("off\n");
}
else
{
evas_object_clip_set(d.img, d.clipper);
printf("on\n");
}
return;
}
if (strcmp(ev->
key,
"v") == 0)
{
printf("Clipper is now ");
if (evas_object_visible_get(d.clipper))
{
printf("hidden\n");
}
else
{
printf("visible\n");
}
return;
}
}
int
main(void)
{
int err;
return EXIT_FAILURE;
if (!d.ee)
evas_object_move(d.bg, 0, 0);
evas_object_resize(d.bg, WIDTH, HEIGHT);
d.img = evas_object_image_filled_add(d.canvas);
evas_object_image_file_set(d.img, img_path, NULL);
err = evas_object_image_load_error_get(d.img);
if (err != EVAS_LOAD_ERROR_NONE)
{
goto panic;
}
else
{
evas_object_move(d.img, 0, 0);
evas_object_resize(d.img, WIDTH, HEIGHT);
printf("Image object added, type is: %s\n",
}
d.clipper_border = evas_object_image_filled_add(d.canvas);
evas_object_image_file_set(d.clipper_border, border_img_path, NULL);
err = evas_object_image_load_error_get(d.clipper_border);
if (err != EVAS_LOAD_ERROR_NONE)
{
goto panic;
}
else
{
evas_object_image_border_set(d.clipper_border, 3, 3, 3, 3);
evas_object_image_border_center_fill_set(
d.clipper_border, EVAS_BORDER_FILL_NONE);
evas_object_move(d.clipper_border, (WIDTH / 4) - 3, (HEIGHT / 4) - 3);
evas_object_resize(
d.clipper_border, (WIDTH / 2) + 6, (HEIGHT / 2) + 6);
}
evas_object_move(d.clipper, WIDTH / 4, HEIGHT / 4);
evas_object_resize(d.clipper, WIDTH / 2, HEIGHT / 2);
evas_object_clip_set(d.img, d.clipper);
return 0;
fprintf(stderr, "you got to have at least one evas engine built and linked"
" up to ecore-evas for this example to run properly.\n");
panic:
return -1;
}