The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Gradients

These changes was commited to the Birdfont repository Sun, 14 Jun 2015 12:29:10 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Sun, 14 Jun 2015 12:29:10 +0000 (14:29 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sun, 14 Jun 2015 12:29:10 +0000 (14:29 +0200)
commit 704e94eb2b7532d5616fbf73afcae0d9527b4807
tree f1d40f4c99149672bbf18a15ba08532c1e90c867
parent 9eed3817a5a1faf17dbb09a89984a14946635438
Gradients

libbirdfont/DrawingTools.vala
libbirdfont/Glyph.vala
libbirdfont/Gradient.vala [new ]
libbirdfont/Path.vala
libbirdfont/Stop.vala [new ]
--- a/libbirdfont/DrawingTools.vala +++ b/libbirdfont/DrawingTools.vala @@ -39,7 +39,7 @@ 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;
--- a/libbirdfont/Glyph.vala +++ b/libbirdfont/Glyph.vala @@ -399,7 +399,7 @@ 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 libbirdfont/Gradient.vala(new)
--- /dev/null +++ b/libbirdfont/Gradient.vala @@ -1,1 +1,47 @@ + /* + 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; + } + } + + }
--- a/libbirdfont/Path.vala +++ b/libbirdfont/Path.vala @@ -22,7 +22,7 @@ COUNTER_CLOCKWISE } - public class Path { + public class Path : GLib.Object { public Gee.ArrayList<EditPoint> points { get {
diff --git libbirdfont/Stop.vala(new)
--- /dev/null +++ b/libbirdfont/Stop.vala @@ -1,1 +1,36 @@ + /* + 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; + } + } + + }