The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Add ClipPath

These changes was commited to the Birdfont repository Fri, 15 Jan 2016 20:33:03 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Fri, 15 Jan 2016 20:33:03 +0000]

Updated Files

birdui/BoxLayout.vala
libsvgbird/ClipPath.vala
--- a/birdui/BoxLayout.vala +++ b/birdui/BoxLayout.vala @@ -32,7 +32,25 @@ 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 @@ if (component.height > h) { component.height = h; } - } + } } public override void layout () { @@ -61,8 +79,9 @@ 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 libsvgbird/ClipPath.vala(new)
--- /dev/null +++ b/libsvgbird/ClipPath.vala @@ -1,1 +1,39 @@ + /* + 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 (); + } + } + + }