Clone in a terminal:
Commit 9f893f4
Johan Mattsson - 2015-12-28T19:29:19+00:00
9f893f4bfd7ffc60447a1d0c9fc029c53cc2536bjohan.mattsson.m@gmail.com

Object properties

Changed files (5)

Diff

diff --git a/libbirdfont/FastPath.vala b/libbirdfont/FastPath.valaindex f1e45b3..78ec3f2 100644--- a/libbirdfont/FastPath.vala+++ b/libbirdfont/FastPath.vala@@ -29,7 +29,115 @@ public class FastPath : Object { 			path.stroke = value; 		} 	}-	++	public override double rotation {+		get {+			return path.rotation;+		}++		set {+			path.rotation = value;+		}+	}++	public override LineCap line_cap {+		get {+			return path.line_cap;+		}++		set {+			path.line_cap = value;+		}+	}++	public override bool fill {+		get {+			return path.fill;+		}++		set {+			path.fill = value;+		}+	}++	public override Color? color {+		get {+			return path.color;+		}++		set {+			path.color = value;+		}+	}++	public override Color? stroke_color {+		get {+			return path.stroke_color;+		}++		set {+			path.stroke_color = value;+		}+	}++	public override Gradient? gradient {+		get {+			return path.gradient;+		}++		set {+			path.gradient = value;+		}+	}++	public override double xmin {+		get {+			return path.xmin;+		}++		set {+			path.xmin = value;+		}+		+		default = Glyph.CANVAS_MAX;+	}++	public override double xmax {+		get {+			return path.xmax;+		}++		set {+			path.xmax = value;+		}+		+		default = Glyph.CANVAS_MIN;+	}++	public override double ymin {+		get {+			return path.ymin;+		}++		set {+			path.ymin = value;+		}+		+		default = Glyph.CANVAS_MAX;+	}++	public override double ymax {+		get {+			return path.ymax;+		}++		set {+			path.ymax = value;+		}+		+		default = Glyph.CANVAS_MIN;+	}+			 	public FastPath () { 		path = new Path (); 		update_region_boundaries ();@@ -54,7 +162,6 @@ public class FastPath : Object { 		bool open; 		 		cr.save ();-		cr.new_path (); 		 		if (c != null) { 			path_color = (!) c;@@ -82,7 +189,6 @@ public class FastPath : Object { 			} 		} -		cr.fill (); 		cr.restore (); 	} @@ -111,8 +217,6 @@ public class FastPath : Object {  	public override void rotate (double theta, double xc, double yc) { 		path.rotate (theta, xc, yc);-		rotation += theta;-		rotation %= 2 * Math.PI; 	} 	 	public override bool is_empty () {diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex a154184..72f67ec 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -799,6 +799,10 @@ public class Glyph : FontDisplay { 		} 	} +	public void delete_object (Object o) {+		layers.remove (o);+	}+ 	public void delete_path (Path p) { 		layers.remove_path(p); 	}@@ -1677,9 +1681,16 @@ public class Glyph : FontDisplay {  	/** Draw filled paths. */ 	public void draw_paths (Context cr, Color? c = null) {+		+		cr.save ();+		cr.new_path ();+		 		foreach (Object o in get_visible_objects ()) { 			o.draw (cr, c); 		}+		+		cr.fill ();+		cr.restore (); 	}  	public void draw_path (Context cr) {diff --git a/libbirdfont/Layer.vala b/libbirdfont/Layer.valaindex a42ae19..f862209 100644--- a/libbirdfont/Layer.vala+++ b/libbirdfont/Layer.vala@@ -232,6 +232,18 @@ public class Layer : GLib.Object { 			l.print (indent + 1); 		} 	}++	public PathList get_paths_in_layer () {+		PathList paths = new PathList ();+		+		foreach (Object object in objects) {+			if (object is FastPath) {+				paths.add (((FastPath) object).get_path ());+			}+		}+		+		return paths;+	} }  }diff --git a/libbirdfont/Object.vala b/libbirdfont/Object.valaindex bdc2447..0a38bf9 100644--- a/libbirdfont/Object.vala+++ b/libbirdfont/Object.vala@@ -20,51 +20,26 @@ namespace BirdFont { public abstract class Object : GLib.Object { 	bool open = false; 	-	public Color? color = null;-	public Color? stroke_color = null;-	public Gradient? gradient = null;+	public abstract Color? color { get; set; }+	public abstract Color? stroke_color { get; set; }+	public abstract Gradient? gradient { get; set; }  	/** Path boundaries */-	public double xmax = Glyph.CANVAS_MIN;-	public double xmin = Glyph.CANVAS_MAX;-	public double ymax = Glyph.CANVAS_MIN;-	public double ymin = Glyph.CANVAS_MAX;-	-	public double rotation = 0;-	public virtual double stroke { get; set; }-	public LineCap line_cap = LineCap.BUTT;+	public abstract double xmax { get; set; }+	public abstract double xmin { get; set; }+	public abstract double ymax { get; set; }+	public abstract double ymin { get; set; } 	+	public abstract double rotation { get; set; }+	public abstract double stroke { get; set; }+	public abstract LineCap line_cap { get; set; default = LineCap.BUTT; }+	public abstract bool fill { get; set; }+		 	public Object () {	 	}  	public Object.create_copy (Object o) {	 		open = o.open;-		-		if (color != null) {-			color = ((!) color).copy ();-		} else {-			color = null;-		}--		if (stroke_color != null) {-			stroke_color = ((!) stroke_color).copy ();-		} else {-			stroke_color = null;-		}--		if (gradient != null) {-			gradient = ((!) gradient).copy ();-		} else {-			gradient = null;-		}-		-		xmax = o.xmax;-		xmin = o.xmin;-		ymax = o.ymax;-		ymin = o.ymin;-		-		rotation = o.rotation;-		stroke = o.stroke; 	} 		 	public void set_open (bool open) {diff --git a/libbirdfont/ObjectGroup.vala b/libbirdfont/ObjectGroup.valaindex 3f9125b..b2a9ca3 100644--- a/libbirdfont/ObjectGroup.vala+++ b/libbirdfont/ObjectGroup.vala@@ -17,6 +17,12 @@ namespace BirdFont { public class ObjectGroup : GLib.Object { 	public Gee.ArrayList<Object> objects; 	+	public int size { +		get {+			return objects.size;+		}+	}+	 	public ObjectGroup () { 		 objects = new Gee.ArrayList<Object> (); 	}

Contact

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