Clone in a terminal:
Commit 882bc9c
Johan Mattsson - 2016-01-15T20:33:03+00:00
882bc9c0b01d6af0cce7e6c6501d3672e516464bjohan.mattsson.m@gmail.com

Add ClipPath

Changed files (2)

Diff

diff --git a/birdui/BoxLayout.vala b/birdui/BoxLayout.valaindex 3d91105..46fa705 100644--- a/birdui/BoxLayout.vala+++ b/birdui/BoxLayout.vala@@ -32,7 +32,25 @@ class BoxLayout : Component { 		this.orientation = orientation; 	} 	-	void set_max_size (Component component) {+	void set_size_limits (Component component) {+		string? min_width = style.get_css_property ("min-width");+		if (min_width != null) {+			double w = SvgFile.parse_number (min_width);+			+			if (component.width < w) {+				component.width = w;+			}+		}++		string? min_height = style.get_css_property ("min-height");+		if (min_height != null) {+			double h = SvgFile.parse_number (min_height);+			+			if (component.height < h) {+				component.height = h;+			}+		}+		 		string? max_width = style.get_css_property ("max-width"); 		if (max_width != null) { 			double w = SvgFile.parse_number (max_width);@@ -49,7 +67,7 @@ class BoxLayout : Component { 			if (component.height > h) { 				component.height = h; 			}-		}	+		} 	} 	 	public override void layout () {@@ -61,8 +79,9 @@ class BoxLayout : Component { 			component.y = child_y; 			component.layout (); 			component.apply_padding ();-			set_max_size (component);+			set_size_limits (component); +			print (@"$(component), $(component.style)\n"); 			if (orientation == BoxOrientation.HORIZONTAL) { 				child_x += component.padded_width; 				diff --git a/libsvgbird/ClipPath.vala b/libsvgbird/ClipPath.valanew file mode 100644index 0000000..3dbcfe4--- /dev/null+++ b/libsvgbird/ClipPath.vala@@ -0,0 +1,38 @@+/*+	Copyright (C) 2016 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;++namespace SvgBird {++public class ClipPath : GLib.Object {+	Layer layer = new Layer ();+	+	public string id {+		get {+			return layer.id;+		}+	}+	+	public ClipPath (Layer layer) {+		this.layer = layer;+	}+	+	public void apply (Context cr) {+		layer.draw_outline (cr);+		cr.clip ();+	}+}++}

Contact

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