The Birdfont Source Code


All Repositories / birdfont.git / commit – 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
author Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 18 Jun 2016 23:14:41 +0000 (01:14 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 18 Jun 2016 23:14:41 +0000 (01:14 +0200)
commit b1a91b1fd26528339f259eeed3baeb8778b609a8
tree 9bf55aa3b2f8fa82a63c71d5a697d29aa6131dd6
parent b25e690afb3eb42074e25200bb7cf3659d767da1
Base class for gradients

libsvgbird/Gradient.vala [new ]
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 (); + + } + + }