6 #define FNAME image_data_argb_alpha_start
7 #define NAME "Image Data ARGB Alpha"
8 #define ICON "data.png"
18 static Evas_Object *o_images[1];
21 static void _setup(void)
26 sl.len = 640 * 480 * 4;
27 sl.mem = malloc(sl.len);
28 for (int i = 0; i < 1; i++)
30 o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
32 efl_gfx_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
33 efl_gfx_buffer_alpha_set(o, 1);
34 efl_gfx_fill_set(o, EINA_RECT(0, 0, 640, 480));
35 efl_gfx_entity_size_set(o, EINA_SIZE2D(640, 480));
36 efl_gfx_entity_visible_set(o, EINA_TRUE);
37 efl_gfx_buffer_managed_set(o, &sl, EINA_SIZE2D(640, 480), 0, EFL_GFX_COLORSPACE_ARGB8888, 0);
43 static void _cleanup(void)
45 for (int i = 0; i < 1; i++)
47 Evas_Object *o = o_images[i];
50 sl = efl_gfx_buffer_managed_get(o, 0);
51 free((void *) sl.mem);
56 /* loop - do things */
57 static void _loop(double t, int f)
60 Evas_Coord x, y, w, h;
62 for (i = 0; i < 1; i++)
64 Evas_Object *o = o_images[i];
66 Eina_Rw_Slice sl = {};
71 x = (win_w / 2) - (w / 2);
72 y = (win_h / 2) - (h / 2);
73 efl_gfx_entity_position_set(o, EINA_POSITION2D(x, y));
74 efl_gfx_entity_size_set(o, EINA_SIZE2D(w, h));
75 efl_gfx_fill_set(o, EINA_RECT(0, 0, w, h));
76 sl = efl_gfx_buffer_map(o, EFL_GFX_BUFFER_ACCESS_MODE_WRITE,
77 &EINA_RECT(0, 0, w, h), EFL_GFX_COLORSPACE_ARGB8888, 0, &st);
80 fprintf(stderr, "ERROR: Failed to map image!\n");
85 for (y = 0; y < h; y++)
87 for (x = 0; x < w; x++)
100 *p = (a << 24) | (r << 16) | (g << 8) | b;
105 efl_gfx_buffer_unmap(o, sl);
106 efl_gfx_buffer_update_add(o, &EINA_RECT(0, 0, w, h));
111 /* prepend special key handlers if interactive (before STD) */
112 static void _key(const char *key)
128 /* template stuff - ignore */
133 //_ui_menu_item_add(ICON, NAME, FNAME);
144 ui_func_set(_key, _loop, _setup);