The Birdfont Source Code


All Repositories / birdfont.git / blobdiff – RSS feed

Linear gradients and matrix tranform on gradients

Changes made to libbirdfont/Svg/SvgStyle.vala

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
--- libbirdfont/Svg/SvgStyle.vala +++ libbirdfont/Svg/SvgStyle.vala @@ -68,7 +68,7 @@ return double.parse (style.get ("stroke-width")); } - public static SvgStyle parse (Attributes attributes) { + public static SvgStyle parse (Defs? d, Attributes attributes) { SvgStyle s = new SvgStyle (); double fill_opacity = 1; double stroke_opacity = 1; @@ -99,8 +99,17 @@ } } + s.stroke_width = SvgFile.parse_number (s.style.get ("stroke-width")); s.stroke = Color.parse (s.style.get ("stroke")); + s.fill = Color.parse (s.style.get ("fill")); + if (d != null) { + Defs defs = (!) d; + + s.stroke_gradient = defs.get_gradient_for_url (s.style.get ("stroke")); + s.fill_gradient = defs.get_gradient_for_url (s.style.get ("fill")); + } + if (s.fill != null) { Color color = (!) s.fill; color.a = fill_opacity; @@ -110,9 +119,6 @@ Color color = (!) s.stroke; color.a = stroke_opacity; } - - s.stroke_width = SvgFile.parse_number (s.style.get ("stroke-width")); - s.fill = Color.parse (s.style.get ("fill")); return s; }