summaryrefslogtreecommitdiff
path: root/src/examples/evas/evas-vg-json.c
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2019-07-22 13:54:25 +0900
committerHermet Park <hermetpark@gmail.com>2019-07-22 13:54:25 +0900
commite97d3c08ea83b611c8b4fd06e1fe5fdd24a1dca9 (patch)
treeb9a3f0f1bbcc67d07b83051f95117f0ca19333fd /src/examples/evas/evas-vg-json.c
parente9f8ef6ea44bdd5750613d88b848d3d1d788de69 (diff)
evas_vg_json: Add image embedded example
Summary: add example code and json resource. plus) Add ECTOR_BACKEND="default" Environment variable because cairo backend is not supported. Depends on D9218 Ector.Renderer : Implement Ector.Renderer.(Software).Image class D9219 Efl.Canvas.Vg : Implement Efl.Canvas.Vg.Image class D9220 vg_common_json : Support image data of node Test Plan: cd .src/examples/evas/ gcc -o evas_vg_json evas-vg-json.c `pkg-config --libs --cflags evas ecore ecore-evas eina ector eo efl` ./evas_vg_json Reviewers: Hermet, kimcinoo, smohanty Subscribers: bu5hm4n, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9351
Diffstat (limited to 'src/examples/evas/evas-vg-json.c')
-rw-r--r--src/examples/evas/evas-vg-json.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/examples/evas/evas-vg-json.c b/src/examples/evas/evas-vg-json.c
index 42047292ea..d0176dbd72 100644
--- a/src/examples/evas/evas-vg-json.c
+++ b/src/examples/evas/evas-vg-json.c
@@ -30,9 +30,9 @@
30#include "evas-common.h" 30#include "evas-common.h"
31 31
32#define WIDTH 400 32#define WIDTH 400
33#define HEIGHT 400 33#define HEIGHT 600
34 34
35static Eo *gvg[4]; 35static Eo *gvg[5];
36 36
37static void 37static void
38running_cb(void *data EINA_UNUSED, const Efl_Event *event) 38running_cb(void *data EINA_UNUSED, const Efl_Event *event)
@@ -41,7 +41,7 @@ running_cb(void *data EINA_UNUSED, const Efl_Event *event)
41 double progress = event_running->progress; 41 double progress = event_running->progress;
42 42
43 int i; 43 int i;
44 for (i = 0; i < 4; i++) 44 for (i = 0; i < 5; i++)
45 { 45 {
46 double frameCnt = (double) (efl_gfx_frame_controller_frame_count_get(gvg[i]) - 1); 46 double frameCnt = (double) (efl_gfx_frame_controller_frame_count_get(gvg[i]) - 1);
47 int frame = (int) (frameCnt * progress); 47 int frame = (int) (frameCnt * progress);
@@ -58,6 +58,9 @@ _on_delete(Ecore_Evas *ee EINA_UNUSED)
58int 58int
59main(void) 59main(void)
60{ 60{
61 //Cairo backend is not supported.
62 setenv("ECTOR_BACKEND", "default", 1);
63
61 if (!ecore_evas_init()) 64 if (!ecore_evas_init())
62 return EXIT_FAILURE; 65 return EXIT_FAILURE;
63 66
@@ -109,6 +112,14 @@ main(void)
109 efl_gfx_entity_size_set(vg4, EINA_SIZE2D(200, 200)); 112 efl_gfx_entity_size_set(vg4, EINA_SIZE2D(200, 200));
110 efl_gfx_entity_visible_set(vg4, EINA_TRUE); 113 efl_gfx_entity_visible_set(vg4, EINA_TRUE);
111 114
115 //5
116 Eo* vg5 = gvg[4] = efl_add(EFL_CANVAS_VG_OBJECT_CLASS, evas);
117 snprintf(buf, sizeof(buf), "%s/image_embedded.json", PACKAGE_EXAMPLES_DIR EVAS_VG_FOLDER);
118 efl_file_simple_load(vg5, buf, NULL);
119 efl_gfx_entity_position_set(vg5, EINA_POSITION2D(0, 400));
120 efl_gfx_entity_size_set(vg5, EINA_SIZE2D(200, 200));
121 efl_gfx_entity_visible_set(vg5, EINA_TRUE);
122
112 //Play custom animation 123 //Play custom animation
113 Eo *anim = efl_add(EFL_CANVAS_ANIMATION_CLASS, evas); 124 Eo *anim = efl_add(EFL_CANVAS_ANIMATION_CLASS, evas);
114 efl_animation_duration_set(anim, efl_gfx_frame_controller_frame_duration_get(vg, 0, 0)); 125 efl_animation_duration_set(anim, efl_gfx_frame_controller_frame_duration_get(vg, 0, 0));