The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Base class for gradients

These changes was commited to the Birdfont repository Sat, 18 Jun 2016 23:14:41 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Sat, 18 Jun 2016 23:14:41 +0000]

Updated Files

libsvgbird/Gradient.vala
diff --git libsvgbird/Gradient.vala(new)
--- /dev/null +++ b/libsvgbird/Gradient.vala @@ -1,1 +1,59 @@ + /* + Copyright (C) 2015 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; + using Math; + + namespace SvgBird { + + public abstract class Gradient : GLib.Object { + public Gee.ArrayList<Stop> stops; + + public string id = ""; + public string? href = null; + public SvgTransforms transforms; + + public Gradient () { + stops = new Gee.ArrayList<Stop> (); + transforms = new SvgTransforms (); + } + + public void copy_stops (Gradient g) { + foreach (Stop stop in g.stops) { + stops.add (stop.copy ()); + } + } + + public Matrix get_matrix () { + return transforms.get_matrix (); + } + + public void copy_gradient (Gradient from, Gradient to) { + foreach (Stop s in from.stops) { + to.stops.add (s.copy ()); + } + + to.id = from.id; + to.href = from.href; + to.transforms = from.transforms.copy (); + + } + + public abstract Gradient copy (); + public abstract string to_string (); + + } + + }