The Birdfont Source Code


All Repositories / birdfont.git / blobdiff – RSS feed

Linear gradients and matrix tranform on gradients

Changes made to libbirdfont/Svg/Gradient.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/Gradient.vala +++ libbirdfont/Svg/Gradient.vala @@ -25,7 +25,9 @@ public Gee.ArrayList<Stop> stops; - public int id = -1; + public string id = ""; + public string? href = null; + public SvgTransforms transforms; public Gradient () { x1 = 0; @@ -33,6 +35,7 @@ x2 = 0; y2 = 0; stops = new Gee.ArrayList<Stop> (); + transforms = new SvgTransforms (); } public Gradient copy () { @@ -47,8 +50,31 @@ } return g; + } + + public void copy_stops (Gradient g) { + foreach (Stop stop in g.stops) { + stops.add (stop.copy ()); + } + } + + public string to_string () { + StringBuilder description = new StringBuilder (); + description.append ("Gradient: "); + description.append (@"x1=$x1, y1=$y1, x2=$x2, y2=$y2"); + + foreach (Stop stop in stops) { + description.append (" "); + description.append (stop.to_string ()); + } + + return description.str; + } + + public Matrix get_matrix () { + return transforms.get_matrix (); } } }