Clone in a terminal:
Commit 704e94e
Johan Mattsson - 2015-06-14T12:29:10+00:00
704e94eb2b7532d5616fbf73afcae0d9527b4807johan.mattsson.m@gmail.com

Gradients

Changed files (5)

Diff

diff --git a/libbirdfont/DrawingTools.vala b/libbirdfont/DrawingTools.valaindex b91066a..f8b7f4d 100644--- a/libbirdfont/DrawingTools.vala+++ b/libbirdfont/DrawingTools.vala@@ -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; 	diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex 29cc1fd..90bbfb1 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -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 ()); 		}diff --git a/libbirdfont/Gradient.vala b/libbirdfont/Gradient.valanew file mode 100644index 0000000..e6ed885--- /dev/null+++ b/libbirdfont/Gradient.vala@@ -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;+	}+}++}diff --git a/libbirdfont/Path.vala b/libbirdfont/Path.valaindex 8635ca8..c0f2e74 100644--- a/libbirdfont/Path.vala+++ b/libbirdfont/Path.vala@@ -22,7 +22,7 @@ public enum Direction { 	COUNTER_CLOCKWISE } -public class Path {+public class Path : GLib.Object { 	 	public Gee.ArrayList<EditPoint> points { 		get  {diff --git a/libbirdfont/Stop.vala b/libbirdfont/Stop.valanew file mode 100644index 0000000..cad54ec--- /dev/null+++ b/libbirdfont/Stop.vala@@ -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;+	}+}++}

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112