summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2019-12-10 19:18:39 +0900
committerHermet Park <hermetpark@gmail.com>2019-12-10 19:18:53 +0900
commitcbd02d3d51c6cbb6c118467088c6cd40f8114820 (patch)
tree50b8cfa12e5d38017a5a222fa2943892f386cd33
parent33af5991289aa2f97eb3b6d645591753dd94432d (diff)
Example: enhance efl-canvas-vg-simple
Summary: - Use path reserve - Use container object Test Plan: ./build/src/examples/evas/efl-canvas-vg-simple Reviewers: Hermet, kimcinoo, smohanty Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10830
-rw-r--r--src/examples/evas/efl-canvas-vg-simple.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/examples/evas/efl-canvas-vg-simple.c b/src/examples/evas/efl-canvas-vg-simple.c
index 36bdfcb..79a9645 100644
--- a/src/examples/evas/efl-canvas-vg-simple.c
+++ b/src/examples/evas/efl-canvas-vg-simple.c
@@ -43,6 +43,8 @@ Ecore_Animator *animator;
43 * the end of the path. 43 * the end of the path.
44 */ 44 */
45static const char *batman = "M 256,213 C 245,181 206,187 234,262 147,181 169,71.2 233,18 220,56 235,81 283,88 285,78.7 286,69.3 288,60 289,61.3 290,62.7 291,64 291,64 297,63 300,63 303,63 309,64 309,64 310,62.7 311,61.3 312,60 314,69.3 315,78.7 317,88 365,82 380,56 367,18 431,71 453,181 366,262 394,187 356,181 344,213 328,185 309,184 300,284 291,184 272,185 256,213 Z"; 45static const char *batman = "M 256,213 C 245,181 206,187 234,262 147,181 169,71.2 233,18 220,56 235,81 283,88 285,78.7 286,69.3 288,60 289,61.3 290,62.7 291,64 291,64 297,63 300,63 303,63 309,64 309,64 310,62.7 311,61.3 312,60 314,69.3 315,78.7 317,88 365,82 380,56 367,18 431,71 453,181 366,262 394,187 356,181 344,213 328,185 309,184 300,284 291,184 272,185 256,213 Z";
46static const unsigned int batman_commandCnt = 17;
47static const unsigned int batman_pointCnt = 86;
46static const char *morph1[2] = {"M 0,0 L 0,0 L 100,0 L 100,0 L 100,100 L 100,100 L 0,100 L 0,100 L 0,0", 48static const char *morph1[2] = {"M 0,0 L 0,0 L 100,0 L 100,0 L 100,100 L 100,100 L 0,100 L 0,100 L 0,0",
47 "M 0,0 L 50,-80 L 100,0 L 180,50 L 100,100 L 50,180 L 0,100 L -80,50 L 0,0"}; 49 "M 0,0 L 50,-80 L 100,0 L 180,50 L 100,100 L 50,180 L 0,100 L -80,50 L 0,0"};
48 50
@@ -422,7 +424,7 @@ _2_interpolation_test()
422{ 424{
423 anim_index = 0; 425 anim_index = 0;
424 426
425 Efl_VG *shape; 427 Efl_VG *shape, *container;
426 428
427 reset_test(); 429 reset_test();
428 430
@@ -430,13 +432,19 @@ _2_interpolation_test()
430 animator = ecore_animator_timeline_add(1, _interpolation_keyframe, NULL); 432 animator = ecore_animator_timeline_add(1, _interpolation_keyframe, NULL);
431 puts(interpolation_menu); 433 puts(interpolation_menu);
432 434
435 // Make Efl.Canvas.Vg.Container Object
436 container = efl_add(EFL_CANVAS_VG_CONTAINER_CLASS, d.vg);
437 // Set the root node of Efl.Canvas.Vg.Object
438 // The Efl.Canvas.Vg.Object searches and renders
439 // Efl.Canvas.Vg.Node(Shape, Container, etc...) from set root node.
440 efl_canvas_vg_object_root_node_set(d.vg, container);
441
433 //Interpolation 'from' and 'to' Object 442 //Interpolation 'from' and 'to' Object
434 shape = efl_add(EFL_CANVAS_VG_SHAPE_CLASS, d.vg, 443 shape = efl_add(EFL_CANVAS_VG_SHAPE_CLASS, d.vg,
435 efl_gfx_path_append_svg_path(efl_added, morph1[0]), // Set SVG path 444 efl_gfx_path_append_svg_path(efl_added, morph1[0]), // Set SVG path
436 efl_gfx_shape_stroke_color_set(efl_added, 255, 0, 0, 255), 445 efl_gfx_shape_stroke_color_set(efl_added, 255, 0, 0, 255),
437 efl_gfx_shape_stroke_width_set(efl_added, 5), 446 efl_gfx_shape_stroke_width_set(efl_added, 5),
438 efl_canvas_vg_node_origin_set(efl_added, 100, 100) 447 efl_canvas_vg_node_origin_set(efl_added, 100, 100));
439);
440 d.shape_list = eina_list_append(d.shape_list, shape); 448 d.shape_list = eina_list_append(d.shape_list, shape);
441 449
442 shape = efl_add(EFL_CANVAS_VG_SHAPE_CLASS, d.vg, 450 shape = efl_add(EFL_CANVAS_VG_SHAPE_CLASS, d.vg,
@@ -447,17 +455,15 @@ _2_interpolation_test()
447 d.shape_list = eina_list_append(d.shape_list, shape); 455 d.shape_list = eina_list_append(d.shape_list, shape);
448 456
449 // Base Object 457 // Base Object
450 shape = efl_add(EFL_CANVAS_VG_SHAPE_CLASS, d.vg); 458 shape = efl_add(EFL_CANVAS_VG_SHAPE_CLASS, container);
451 d.shape_list = eina_list_append(d.shape_list, shape); 459 d.shape_list = eina_list_append(d.shape_list, shape);
452 460
453 efl_canvas_vg_object_root_node_set(d.vg, shape);
454} 461}
455 462
456// 2. Interpolation Test Case END 463// 2. Interpolation Test Case END
457 464
458 465
459// 3. Gradient Test Case START 466// 3. Gradient Test Case START
460
461static void 467static void
462_gradient_key_handle(void *data EINA_UNUSED, const Efl_Event *ev) 468_gradient_key_handle(void *data EINA_UNUSED, const Efl_Event *ev)
463{ 469{
@@ -559,7 +565,7 @@ _3_gradient_test()
559static void 565static void
560_main_menu() 566_main_menu()
561{ 567{
562 Efl_VG *shape; 568 Efl_VG *shape, *container;
563 if (animator) ecore_animator_del(animator); 569 if (animator) ecore_animator_del(animator);
564 animator = NULL; 570 animator = NULL;
565 if(d.vg) efl_del(d.vg); 571 if(d.vg) efl_del(d.vg);
@@ -575,18 +581,23 @@ _main_menu()
575 d.vg = efl_add(EFL_CANVAS_VG_OBJECT_CLASS, d.evas, 581 d.vg = efl_add(EFL_CANVAS_VG_OBJECT_CLASS, d.evas,
576 efl_gfx_entity_visible_set(efl_added, EINA_TRUE)); 582 efl_gfx_entity_visible_set(efl_added, EINA_TRUE));
577 583
584 // Make Efl.Canvas.Vg.Container Object
585 container = efl_add(EFL_CANVAS_VG_CONTAINER_CLASS, d.vg);
586 // Set the root node of Efl.Canvas.Vg.Object
587 // The Efl.Canvas.Vg.Object searches and renders
588 // Efl.Canvas.Vg.Node(Shape, Container, etc...) from set root node.
589 efl_canvas_vg_object_root_node_set(d.vg, container);
590
578 // Make Efl.Canvas.Vg.Shape 591 // Make Efl.Canvas.Vg.Shape
579 shape = efl_add(EFL_CANVAS_VG_SHAPE_CLASS, d.vg, 592 shape = efl_add(EFL_CANVAS_VG_SHAPE_CLASS, container,
580 efl_gfx_path_append_svg_path(efl_added, batman), // Set SVG path
581 efl_gfx_shape_stroke_color_set(efl_added, 255, 0, 0, 255), // Set Stroke color 593 efl_gfx_shape_stroke_color_set(efl_added, 255, 0, 0, 255), // Set Stroke color
582 efl_gfx_shape_stroke_width_set(efl_added, 5), // Set Stroke width 594 efl_gfx_shape_stroke_width_set(efl_added, 5), // Set Stroke width
583 efl_gfx_color_set(efl_added, 255, 255, 0, 255), // Set Fill color 595 efl_gfx_color_set(efl_added, 255, 255, 0, 255), // Set Fill color
584 efl_canvas_vg_node_origin_set(efl_added, 25, 100)); // Set Position 596 efl_canvas_vg_node_origin_set(efl_added, 25, 100)); // Set Position
585 597
586 // Set the root node of Efl.Canvas.Vg.Object 598 // Reserve memory for the number of commands and pointers
587 // The Efl.Canvas.Vg.Object searches and renders 599 efl_gfx_path_reserve(shape, batman_commandCnt, batman_pointCnt);
588 // Efl.Canvas.Vg.Node(Shape, Container, etc...) from set root node. 600 efl_gfx_path_append_svg_path(shape, batman); // Set SVG path
589 efl_canvas_vg_object_root_node_set(d.vg, shape);
590 601
591 _canvas_resize_cb(d.ee); 602 _canvas_resize_cb(d.ee);
592 puts(main_menu); 603 puts(main_menu);