diff options
author | JunsuChoi <jsuya.choi@samsung.com> | 2019-10-02 14:30:06 +0900 |
---|---|---|
committer | JunsuChoi <jsuya.choi@samsung.com> | 2019-10-02 14:30:06 +0900 |
commit | 779bd0539eb6ab8050289da83d0792670a15422c (patch) | |
tree | d40a315662f3fc92cd47d5aa404859f7b26a8aca /src | |
parent | 6deb21f9f9e326921c16dabbd774b8d1666867c8 (diff) |
vg_common_json: Override value_provider list
Summary:
If value_provider is applied to Efl.Ui.Animation_View, it is passed as vector object.
The passed value_provider list passes to Vg_File_Data.
If there is a value_Provider list in Vg_File_Data,
it apply the property to Lottie_Animation using lottie_animation_property_override api.
Depends on D9874
Test Plan:
...
Eo *vp = efl_add(EFL_GFX_VG_VALUE_PROVIDER_CLASS, p);
efl_gfx_vg_value_provider_keypath_set(vp, "**");
efl_gfx_vg_value_provider_fill_color_set(vp, 100, 0 ,0 ,255);
efl_ui_animation_view_value_provider_override(anim_view, vp);
vp = efl_add(EFL_GFX_VG_VALUE_PROVIDER_CLASS, p);
efl_gfx_vg_value_provider_keypath_set(vp, "**");
efl_gfx_vg_value_provider_stroke_width_set(vp, 50.0);
efl_gfx_vg_value_provider_stroke_color_set(vp, 0, 255, 0, 100);
efl_ui_animation_view_value_provider_override(anim_view, vp);
...
Reviewers: Hermet, kimcinoo, smohanty
Reviewed By: Hermet
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9897
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/elementary/efl_ui_animation_view.c | 1 | ||||
-rw-r--r-- | src/lib/evas/canvas/efl_canvas_vg_object.c | 2 | ||||
-rw-r--r-- | src/lib/evas/include/evas_private.h | 1 | ||||
-rw-r--r-- | src/static_libs/vg_common/vg_common.h | 1 | ||||
-rw-r--r-- | src/static_libs/vg_common/vg_common_json.c | 55 |
5 files changed, 60 insertions, 0 deletions
diff --git a/src/lib/elementary/efl_ui_animation_view.c b/src/lib/elementary/efl_ui_animation_view.c index bca8c1d..82aba0f 100644 --- a/src/lib/elementary/efl_ui_animation_view.c +++ b/src/lib/elementary/efl_ui_animation_view.c | |||
@@ -741,6 +741,7 @@ _efl_ui_animation_view_value_provider_override(Eo *obj EINA_UNUSED, Efl_Ui_Anima | |||
741 | 741 | ||
742 | efl_ref(value_provider); | 742 | efl_ref(value_provider); |
743 | pd->vp_list = eina_list_append(pd->vp_list, value_provider); | 743 | pd->vp_list = eina_list_append(pd->vp_list, value_provider); |
744 | efl_key_data_set(pd->vg, "_vg_value_providers", pd->vp_list); | ||
744 | } | 745 | } |
745 | 746 | ||
746 | EAPI Elm_Animation_View* | 747 | EAPI Elm_Animation_View* |
diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c index 0c8e50b..660d1eb 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_object.c +++ b/src/lib/evas/canvas/efl_canvas_vg_object.c | |||
@@ -616,6 +616,8 @@ _cache_vg_entry_render(Evas_Object_Protected_Data *obj, | |||
616 | h = size.h; | 616 | h = size.h; |
617 | 617 | ||
618 | } | 618 | } |
619 | if (pd->vg_entry->vfd) | ||
620 | pd->vg_entry->vfd->vp_list = efl_key_data_get(obj->object, "_vg_value_providers"); | ||
619 | root = evas_cache_vg_tree_get(vg_entry, pd->frame_idx); | 621 | root = evas_cache_vg_tree_get(vg_entry, pd->frame_idx); |
620 | if (!root) return; | 622 | if (!root) return; |
621 | 623 | ||
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index c80053c..86bb885 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h | |||
@@ -1541,6 +1541,7 @@ struct _Vg_File_Data | |||
1541 | Vg_File_Anim_Data *anim_data; //only when animation supported. | 1541 | Vg_File_Anim_Data *anim_data; //only when animation supported. |
1542 | int ref; | 1542 | int ref; |
1543 | int w, h; //default size | 1543 | int w, h; //default size |
1544 | Eina_List *vp_list; //Value providers. | ||
1544 | 1545 | ||
1545 | void *loader_data; //loader specific local data | 1546 | void *loader_data; //loader specific local data |
1546 | 1547 | ||
diff --git a/src/static_libs/vg_common/vg_common.h b/src/static_libs/vg_common/vg_common.h index 520fcdb..83f9224 100644 --- a/src/static_libs/vg_common/vg_common.h +++ b/src/static_libs/vg_common/vg_common.h | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include "evas_common_private.h" | 8 | #include "evas_common_private.h" |
9 | #include "evas_private.h" | 9 | #include "evas_private.h" |
10 | #include "evas_vg_private.h" | ||
10 | 11 | ||
11 | /****************************************************************************************** | 12 | /****************************************************************************************** |
12 | * SVG Compatible feature implementation | 13 | * SVG Compatible feature implementation |
diff --git a/src/static_libs/vg_common/vg_common_json.c b/src/static_libs/vg_common/vg_common_json.c index 3b3d114..5ad4150 100644 --- a/src/static_libs/vg_common/vg_common_json.c +++ b/src/static_libs/vg_common/vg_common_json.c | |||
@@ -443,6 +443,59 @@ _update_vg_tree(Efl_Canvas_Vg_Container *root, const LOTLayerNode *layer, int de | |||
443 | } | 443 | } |
444 | #endif | 444 | #endif |
445 | 445 | ||
446 | #ifdef BUILD_VG_LOADER_JSON | ||
447 | void | ||
448 | _value_provider_override(Vg_File_Data *vfd) | ||
449 | { | ||
450 | Lottie_Animation *lot_anim = (Lottie_Animation *) vfd->loader_data; | ||
451 | |||
452 | Eina_List *l; | ||
453 | Efl_Gfx_Vg_Value_Provider *vp; | ||
454 | EINA_LIST_FOREACH(vfd->vp_list, l, vp) | ||
455 | { | ||
456 | const char *keypath; | ||
457 | Efl_Gfx_Vg_Value_Provider_Change_Flag flag; | ||
458 | flag = efl_gfx_vg_value_provider_changed_flag_get(vp); | ||
459 | |||
460 | if (flag & EFL_GFX_VG_VALUE_PROVIDER_CHANGE_FLAG_FILL_COLOR) | ||
461 | { | ||
462 | int r, g, b, a; | ||
463 | r = g = b = a = 0; | ||
464 | efl_gfx_vg_value_provider_fill_color_get(vp, &r, &g, &b, &a); | ||
465 | keypath = efl_gfx_vg_value_provider_keypath_get(vp); | ||
466 | |||
467 | lottie_animation_property_override(lot_anim, LOTTIE_ANIMATION_PROPERTY_FILLCOLOR, (char*)keypath, r / 255.0, g / 255.0, b / 255.0); | ||
468 | lottie_animation_property_override(lot_anim, LOTTIE_ANIMATION_PROPERTY_FILLOPACITY, (char*)keypath, (a / 255.0) * 100.0); | ||
469 | } | ||
470 | if (flag & EFL_GFX_VG_VALUE_PROVIDER_CHANGE_FLAG_STROKE_COLOR) | ||
471 | { | ||
472 | int r, g, b, a; | ||
473 | r = g = b = a = 0; | ||
474 | efl_gfx_vg_value_provider_stroke_color_get(vp, &r, &g, &b, &a); | ||
475 | keypath = efl_gfx_vg_value_provider_keypath_get(vp); | ||
476 | |||
477 | lottie_animation_property_override(lot_anim, LOTTIE_ANIMATION_PROPERTY_STROKECOLOR, (char*)keypath, r / 255.0, g / 255.0, b / 255.0); | ||
478 | lottie_animation_property_override(lot_anim, LOTTIE_ANIMATION_PROPERTY_STROKEOPACITY, (char*)keypath, (a / 255.0) * 100.0); | ||
479 | } | ||
480 | if (flag & EFL_GFX_VG_VALUE_PROVIDER_CHANGE_FLAG_STROKE_WIDTH) | ||
481 | { | ||
482 | double w; | ||
483 | w = efl_gfx_vg_value_provider_stroke_width_get(vp); | ||
484 | keypath = efl_gfx_vg_value_provider_keypath_get(vp); | ||
485 | |||
486 | lottie_animation_property_override(lot_anim, LOTTIE_ANIMATION_PROPERTY_STROKEWIDTH, (char*)keypath, w); | ||
487 | } | ||
488 | if (flag & EFL_GFX_VG_VALUE_PROVIDER_CHANGE_FLAG_TRANSFORM_MATRIX) | ||
489 | { | ||
490 | //TODO: When the lottie animation's transform property is implemented, | ||
491 | // the transform property override function have to added. | ||
492 | } | ||
493 | } | ||
494 | } | ||
495 | |||
496 | #endif | ||
497 | |||
498 | |||
446 | Eina_Bool | 499 | Eina_Bool |
447 | vg_common_json_create_vg_node(Vg_File_Data *vfd) | 500 | vg_common_json_create_vg_node(Vg_File_Data *vfd) |
448 | { | 501 | { |
@@ -450,6 +503,8 @@ vg_common_json_create_vg_node(Vg_File_Data *vfd) | |||
450 | Lottie_Animation *lot_anim = (Lottie_Animation *) vfd->loader_data; | 503 | Lottie_Animation *lot_anim = (Lottie_Animation *) vfd->loader_data; |
451 | if (!lot_anim) return EINA_FALSE; | 504 | if (!lot_anim) return EINA_FALSE; |
452 | 505 | ||
506 | if (vfd->vp_list) _value_provider_override(vfd); | ||
507 | |||
453 | unsigned int frame_num = (vfd->anim_data) ? vfd->anim_data->frame_num : 0; | 508 | unsigned int frame_num = (vfd->anim_data) ? vfd->anim_data->frame_num : 0; |
454 | const LOTLayerNode *tree = | 509 | const LOTLayerNode *tree = |
455 | lottie_animation_render_tree(lot_anim, frame_num, | 510 | lottie_animation_render_tree(lot_anim, frame_num, |