summaryrefslogtreecommitdiff
path: root/src/static_libs
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-06-27 13:16:36 +0900
committerHermet Park <hermetpark@gmail.com>2019-06-27 13:18:28 +0900
commit7fcf887b6380efa43be6cdea91f85078a83d29dd (patch)
treee3169f2710e6afa654d3643cacd726040dc52dee /src/static_libs
parent35a5ed14942600626ab5c257288867e3e75039fb (diff)
evas svg: fix missing node opacity attribute.
Any svg node could have its opacity value, we missed implementing it. If a node have a opacity, it's opacity could be multiply with fill and stroke colors. @fix
Diffstat (limited to 'src/static_libs')
-rw-r--r--src/static_libs/vg_common/vg_common.h1
-rw-r--r--src/static_libs/vg_common/vg_common_svg.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/src/static_libs/vg_common/vg_common.h b/src/static_libs/vg_common/vg_common.h
index fc8d566144..731a8d2796 100644
--- a/src/static_libs/vg_common/vg_common.h
+++ b/src/static_libs/vg_common/vg_common.h
@@ -272,6 +272,7 @@ struct _Svg_Style_Property
272 int r; 272 int r;
273 int g; 273 int g;
274 int b; 274 int b;
275 int opacity;
275}; 276};
276 277
277struct _Svg_Node 278struct _Svg_Node
diff --git a/src/static_libs/vg_common/vg_common_svg.c b/src/static_libs/vg_common/vg_common_svg.c
index d14d9dd847..e753e229d0 100644
--- a/src/static_libs/vg_common/vg_common_svg.c
+++ b/src/static_libs/vg_common/vg_common_svg.c
@@ -183,6 +183,8 @@ _eet_for_style_property(void)
183 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "r", r, EET_T_INT); 183 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "r", r, EET_T_INT);
184 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "g", g, EET_T_INT); 184 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "g", g, EET_T_INT);
185 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "b", b, EET_T_INT); 185 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "b", b, EET_T_INT);
186 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "opacity", opacity, EET_T_INT);
187
186 // for fill 188 // for fill
187 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "fill.flags", fill.flags, EET_T_INT); 189 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "fill.flags", fill.flags, EET_T_INT);
188 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "fill.paint.r", fill.paint.r, EET_T_INT); 190 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "fill.paint.r", fill.paint.r, EET_T_INT);
@@ -731,6 +733,15 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg, Efl_VG *parent, Vg_File_Data *vg_
731 style->fill.paint.b, style->fill.opacity); 733 style->fill.paint.b, style->fill.opacity);
732 } 734 }
733 735
736 //apply node opacity
737 if (style->opacity < 255)
738 {
739 int r, g, b, a;
740 efl_gfx_color_get(vg, &r, &g, &b, &a);
741 float fa = ((float) style->opacity / 255);
742 efl_gfx_color_set(vg, ((float) r) * fa, ((float) g) * fa, ((float) b) * fa, ((float) a) * fa);
743 }
744
734 efl_gfx_shape_stroke_width_set(vg, style->stroke.width); 745 efl_gfx_shape_stroke_width_set(vg, style->stroke.width);
735 efl_gfx_shape_stroke_cap_set(vg, style->stroke.cap); 746 efl_gfx_shape_stroke_cap_set(vg, style->stroke.cap);
736 efl_gfx_shape_stroke_join_set(vg, style->stroke.join); 747 efl_gfx_shape_stroke_join_set(vg, style->stroke.join);
@@ -906,6 +917,7 @@ _create_node(Svg_Node *parent, Svg_Node_Type type)
906 // default line join is miter 917 // default line join is miter
907 node->style->stroke.join = EFL_GFX_JOIN_MITER; 918 node->style->stroke.join = EFL_GFX_JOIN_MITER;
908 node->style->stroke.scale = 1.0; 919 node->style->stroke.scale = 1.0;
920 node->style->opacity = 255;
909 921
910 node->parent = parent; 922 node->parent = parent;
911 node->type = type; 923 node->type = type;