summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-04-03 16:31:27 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-04-03 16:31:27 +0200
commitabc64b75267bff4ac7cd8bb758172bb3ea7eb36e (patch)
treee9ffc2ce2838aca44db30c3db968a98ebd9bb297 /src/examples
parenta104344d7e641372db1856183b23e7e638c435b9 (diff)
evas: migrate Efl.VG example to legacy API.
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/evas/evas-vg-simple.c145
1 files changed, 66 insertions, 79 deletions
diff --git a/src/examples/evas/evas-vg-simple.c b/src/examples/evas/evas-vg-simple.c
index 698db11..168bb42 100644
--- a/src/examples/evas/evas-vg-simple.c
+++ b/src/examples/evas/evas-vg-simple.c
@@ -349,7 +349,7 @@ Point _curves_for_arc(int x, int y, int w, int h,
349 return startPoint; 349 return startPoint;
350} 350}
351 351
352void _arcto(Evas_VG_Node *obj, int x, int y, int width, int height, int startAngle, int sweepLength) 352void _arcto(Efl_VG *obj, int x, int y, int width, int height, int startAngle, int sweepLength)
353{ 353{
354 int point_count; 354 int point_count;
355 355
@@ -359,27 +359,25 @@ void _arcto(Evas_VG_Node *obj, int x, int y, int width, int height, int startAng
359 int cy = y + (height)/2; 359 int cy = y + (height)/2;
360 int i; 360 int i;
361 361
362 eo_do(obj, 362 evas_vg_shape_shape_append_move_to(obj, cx, cy);
363 efl_gfx_shape_append_move_to(cx, cy); 363 evas_vg_shape_shape_append_line_to(obj, curve_start.x, curve_start.y);
364 364 for (i = 0; i < point_count; i += 3)
365 efl_gfx_shape_append_line_to(curve_start.x, curve_start.y); 365 {
366 for (i = 0; i < point_count; i += 3) 366 evas_vg_shape_shape_append_cubic_to(obj,
367 { 367 pts[i+2].x, pts[i+2].y,
368 efl_gfx_shape_append_cubic_to(pts[i+2].x, pts[i+2].y,
369 pts[i].x, pts[i].y, 368 pts[i].x, pts[i].y,
370 pts[i+1].x, pts[i+1].y); 369 pts[i+1].x, pts[i+1].y);
371 } 370 }
372 efl_gfx_shape_append_close()); 371 evas_vg_shape_shape_append_close(obj);
373} 372}
374 373
375void _rect_add(Evas_VG_Node *obj, int x, int y, int w, int h) 374void _rect_add(Efl_VG *obj, int x, int y, int w, int h)
376{ 375{
377 eo_do(obj, 376 evas_vg_shape_shape_append_move_to(obj, x, y);
378 efl_gfx_shape_append_move_to(x, y); 377 evas_vg_shape_shape_append_line_to(obj, x + w, y);
379 efl_gfx_shape_append_line_to(x + w, y); 378 evas_vg_shape_shape_append_line_to(obj, x + w, y +h);
380 efl_gfx_shape_append_line_to(x + w, y +h); 379 evas_vg_shape_shape_append_line_to(obj, x, y +h);
381 efl_gfx_shape_append_line_to(x, y +h); 380 evas_vg_shape_shape_append_close(obj);
382 efl_gfx_shape_append_close());
383} 381}
384 382
385 383
@@ -441,19 +439,18 @@ vector_set(int x, int y, int w, int h)
441 Eina_Matrix3 matrix; 439 Eina_Matrix3 matrix;
442 eina_matrix3_rotate(&matrix, radian); 440 eina_matrix3_rotate(&matrix, radian);
443 441
444 Evas_VG_Node *root = evas_object_vg_root_node_get(d.vg); 442 Efl_VG *root = evas_object_vg_root_node_get(d.vg);
445 //eo_do(root, evas_vg_node_transformation_set(&matrix)); 443 //eo_do(root, evas_vg_node_transformation_set(&matrix));
446 444
447 Evas_VG_Node *bg = eo_add(EVAS_VG_SHAPE_CLASS, root); 445 Efl_VG *bg = eo_add(EFL_VG_SHAPE_CLASS, root);
448 _rect_add(bg, 0, 0 , vg_w, vg_h); 446 _rect_add(bg, 0, 0 , vg_w, vg_h);
449 eo_do(bg, 447 evas_vg_node_origin_set(bg, 0,0);
450 evas_vg_node_origin_set(0, 0), 448 evas_vg_shape_stroke_width_set(bg, 1.0);
451 efl_gfx_shape_stroke_width_set(1.0), 449 evas_vg_node_color_set(bg, 80, 80, 80, 80);
452 efl_gfx_color_set(128, 128, 128, 80));
453 450
454 Evas_VG_Node *shape = eo_add(EVAS_VG_SHAPE_CLASS, root); 451 Efl_VG *shape = eo_add(EFL_VG_SHAPE_CLASS, root);
455 Evas_VG_Node *rgradient = eo_add(EVAS_VG_GRADIENT_RADIAL_CLASS, root); 452 Efl_VG *rgradient = eo_add(EFL_VG_GRADIENT_RADIAL_CLASS, root);
456 Evas_VG_Node *lgradient = eo_add(EVAS_VG_GRADIENT_LINEAR_CLASS, root); 453 Efl_VG *lgradient = eo_add(EFL_VG_GRADIENT_LINEAR_CLASS, root);
457 454
458 _arcto(shape, 0, 0, 100, 100, 25, 330); 455 _arcto(shape, 0, 0, 100, 100, 25, 330);
459 456
@@ -474,65 +471,56 @@ vector_set(int x, int y, int w, int h)
474 stops[2].a = 255; 471 stops[2].a = 255;
475 stops[2].offset = 1; 472 stops[2].offset = 1;
476 473
477 eo_do(rgradient, 474 evas_vg_node_origin_set(rgradient, 10, 10);
478 evas_vg_node_origin_set(10,10), 475 evas_vg_gradient_spread_set(rgradient, EFL_GFX_GRADIENT_SPREAD_REFLECT);
479 efl_gfx_gradient_stop_set(stops, 3), 476 evas_vg_gradient_stop_set(rgradient, stops, 3);
480 efl_gfx_gradient_spread_set(EFL_GFX_GRADIENT_SPREAD_REFLECT), 477 evas_vg_gradient_radial_center_set(rgradient, 30, 30);
481 efl_gfx_gradient_stop_set(stops, 3), 478 evas_vg_gradient_radial_radius_set(rgradient, 80);
482 efl_gfx_gradient_radial_center_set(30, 30), 479
483 efl_gfx_gradient_radial_radius_set(80)); 480 evas_vg_node_origin_set(lgradient, 10, 10);
484 481 evas_vg_gradient_stop_set(lgradient, stops, 3);
485 eo_do(lgradient, 482 evas_vg_gradient_spread_set(lgradient, EFL_GFX_GRADIENT_SPREAD_REFLECT);
486 evas_vg_node_origin_set(10,10), 483 evas_vg_gradient_stop_set(lgradient, stops, 3);
487 efl_gfx_gradient_stop_set(stops, 3), 484 evas_vg_gradient_linear_start_set(lgradient, 10, 10);
488 efl_gfx_gradient_spread_set(EFL_GFX_GRADIENT_SPREAD_REFLECT), 485 evas_vg_gradient_linear_end_set(lgradient, 50, 50);
489 efl_gfx_gradient_stop_set(stops, 3), 486
490 efl_gfx_gradient_linear_start_set(10,10), 487 evas_vg_node_origin_set(shape, 10, 10);
491 efl_gfx_gradient_linear_end_set(50,50)); 488 evas_vg_shape_fill_set(shape, rgradient);
492 489 evas_vg_shape_stroke_scale_set(shape, 2.0);
493 eo_do(shape, 490 evas_vg_shape_stroke_width_set(shape, 1.0);
494 evas_vg_node_origin_set(10, 10), 491 evas_vg_node_color_set(shape, 0, 0, 255, 255);
495 evas_vg_shape_fill_set(rgradient), 492 evas_vg_shape_stroke_color_set(shape, 0, 0, 255, 128);
496 efl_gfx_shape_stroke_scale_set(2.0), 493
497 efl_gfx_shape_stroke_width_set(1.0), 494 Efl_VG *rect = eo_add(EFL_VG_SHAPE_CLASS, root);
498 efl_gfx_color_set(0, 0, 255, 255),
499 efl_gfx_shape_stroke_color_set(0, 0, 255, 128));
500
501 Evas_VG_Node *rect = eo_add(EVAS_VG_SHAPE_CLASS, root);
502 _rect_add(rect, 0, 0, 100, 100); 495 _rect_add(rect, 0, 0, 100, 100);
503 eo_do(rect, 496 evas_vg_node_origin_set(rect, 100, 100);
504 evas_vg_node_origin_set(100, 100), 497 evas_vg_shape_fill_set(rect, lgradient);
505 evas_vg_shape_fill_set(lgradient), 498 evas_vg_shape_stroke_width_set(rect, 2.0);
506 efl_gfx_shape_stroke_width_set(2.0), 499 evas_vg_shape_stroke_join_set(rect, EFL_GFX_JOIN_ROUND);
507 efl_gfx_shape_stroke_join_set(EFL_GFX_JOIN_ROUND), 500 evas_vg_shape_stroke_color_set(rect, 255, 255, 255, 255);
508 efl_gfx_shape_stroke_color_set(255, 255, 255, 255));
509
510 501
511 Evas_VG_Node *rect1 = eo_add(EVAS_VG_SHAPE_CLASS, root); 502 Efl_VG *rect1 = eo_add(EFL_VG_SHAPE_CLASS, root);
512 _rect_add(rect1, 0, 0, 70, 70); 503 _rect_add(rect1, 0, 0, 70, 70);
513 eo_do(rect1, 504 evas_vg_node_origin_set(rect1, 50, 70);
514 evas_vg_node_origin_set(50, 70), 505 evas_vg_shape_stroke_scale_set(rect1, 2);
515 efl_gfx_shape_stroke_scale_set(2), 506 evas_vg_shape_stroke_width_set(rect1, 8.0);
516 efl_gfx_shape_stroke_width_set(8.0), 507 evas_vg_shape_stroke_join_set(rect1, EFL_GFX_JOIN_ROUND);
517 efl_gfx_shape_stroke_join_set(EFL_GFX_JOIN_ROUND), 508 evas_vg_shape_stroke_color_set(rect1, 0, 100, 80, 100);
518 efl_gfx_shape_stroke_color_set(0, 100, 80, 100)); 509
519 510 Efl_VG *circle = eo_add(EFL_VG_SHAPE_CLASS, root);
520 Evas_VG_Node *circle = eo_add(EVAS_VG_SHAPE_CLASS, root);
521 _arcto(circle, 0, 0, 250, 100, 30, 300); 511 _arcto(circle, 0, 0, 250, 100, 30, 300);
522 eo_do(circle, 512 evas_vg_shape_fill_set(circle, lgradient);
523 evas_vg_shape_fill_set(lgradient), 513 //evas_vg_node_transformation_set(&matrix),
524 //evas_vg_node_transformation_set(&matrix), 514 evas_vg_node_origin_set(circle, 50,50);
525 evas_vg_node_origin_set(50,50), 515 evas_vg_node_color_set(circle, 50, 0, 0, 50);
526 efl_gfx_color_set(50, 0, 0, 50));
527 516
528 // Foreground 517 // Foreground
529 Evas_VG_Node *fg = eo_add(EVAS_VG_SHAPE_CLASS, root); 518 Efl_VG *fg = eo_add(EFL_VG_SHAPE_CLASS, root);
530 _rect_add(fg, 0, 0, vg_w, vg_h); 519 _rect_add(fg, 0, 0, vg_w, vg_h);
531 eo_do(fg, 520 evas_vg_node_origin_set(fg, 0, 0);
532 evas_vg_node_origin_set(0, 0), 521 evas_vg_shape_stroke_width_set(fg, 5.0);
533 efl_gfx_shape_stroke_width_set(5.0), 522 evas_vg_shape_stroke_join_set(fg, EFL_GFX_JOIN_ROUND);
534 efl_gfx_shape_stroke_join_set(EFL_GFX_JOIN_ROUND), 523 evas_vg_shape_stroke_color_set(fg, 70, 70, 0, 70);
535 efl_gfx_shape_stroke_color_set(70, 70, 0, 70));
536} 524}
537 525
538int 526int
@@ -570,4 +558,3 @@ error:
570 ecore_evas_shutdown(); 558 ecore_evas_shutdown();
571 return -1; 559 return -1;
572} 560}
573