Commit 704e94e
Gradients
Changed files (5)
modifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/Glyph.valaaddedlibbirdfont/Gradient.valamodifiedlibbirdfont/Path.valaaddedlibbirdfont/Stop.vala
Diff
@@ -39,7 +39,7 @@ public class DrawingTools : ToolCollection { public static PointType point_type = PointType.DOUBLE_CURVE; - public static Tool add_stroke; + public static Tool add_stroke { get; set; } public static SpinButton object_stroke; Tool outline; @@ -399,7 +399,7 @@ public class Glyph : FontDisplay { redraw_area (0, 0, allocation.width, allocation.height); } - public void add_path (Path p) {+ public virtual void add_path (Path p) { if (layers.subgroups.size == 0) { layers.add_layer (new Layer ()); }new file mode 100644@@ -0,0 +1,46 @@+/*+ Copyright (C) 2015 Johan Mattsson++ This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version.++ This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details.+*/++using Cairo;+using Math;++namespace BirdFont {++public class Gradient : GLib.Object {+ public double x1 = 0;+ public double y1 = 0;+ public double x2 = 0;+ public double y2 = 0;+ + Gee.ArrayList<Stop> stops = new Gee.ArrayList<Stop> ();+ + public Gradient () {+ }+ + public Gradient copy () {+ Gradient g = new Gradient ();+ g.x1 = x1;+ g.y1 = y1;+ g.x2 = x2;+ g.x2 = y2;+ + foreach (Stop s in stops) {+ g.stops.add (s.copy ());+ }+ + return g;+ }+}++}@@ -22,7 +22,7 @@ public enum Direction { COUNTER_CLOCKWISE } -public class Path {+public class Path : GLib.Object { public Gee.ArrayList<EditPoint> points { get {new file mode 100644@@ -0,0 +1,35 @@+/*+ Copyright (C) 2015 Johan Mattsson++ This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version.++ This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details.+*/++using Cairo;+using Math;++namespace BirdFont {++public class Stop : GLib.Object {+ public Color color = Color.black ();+ double offset = 0;+ + public Stop () {+ }+ + public Stop copy () {+ Stop s = new Stop ();+ s.color = color.copy ();+ s.offset = offset;+ return s;+ }+}++}