The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Move radial gradients

These changes was commited to the Birdfont repository Tue, 19 Jul 2016 19:08:14 +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>
Tue, 19 Jul 2016 19:08:14 +0000 (21:08 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Tue, 19 Jul 2016 19:08:14 +0000 (21:08 +0200)
commit d573ed0fda5b9741faa95bb0c343f3ea2b6614a6
tree 0cefe50f21db7009854bc905ff3d2fc988862bc4
parent 10b1900dcc20c88f95ee7cc89c9ad66b33397e95
Move radial gradients

libsvgbird/Gradient.vala
libsvgbird/LinearGradient.vala
libsvgbird/RadialGradient.vala
--- a/libsvgbird/Gradient.vala +++ b/libsvgbird/Gradient.vala @@ -37,21 +37,9 @@ } } - public void move (double dx, double dy) { - double x = dx; - double y = dy; - - Matrix parent = parent_matrix; - parent.invert (); - parent.transform_distance (ref x, ref y); - - Matrix m = Matrix.identity (); - m.translate (-x, -y); - - transforms.transforms.insert (0, new SvgTransform.for_matrix (m)); - transforms.collapse_transforms (); + public virtual void move (double dx, double dy) { } - + public Matrix get_matrix () { return transforms.get_matrix (); }
--- a/libsvgbird/LinearGradient.vala +++ b/libsvgbird/LinearGradient.vala @@ -59,8 +59,23 @@ } return description.str; + } + + public override void move (double dx, double dy) { + double x = dx; + double y = dy; + + Matrix parent = parent_matrix; + parent.invert (); + parent.transform_distance (ref x, ref y); + + Matrix m = Matrix.identity (); + m.translate (-x, -y); + + transforms.transforms.insert (0, new SvgTransform.for_matrix (m)); + transforms.collapse_transforms (); } } }
--- a/libsvgbird/RadialGradient.vala +++ b/libsvgbird/RadialGradient.vala @@ -55,7 +55,18 @@ return description.str; } + public override void move (double dx, double dy) { + double x = dx; + double y = dy; + + Matrix parent = parent_matrix; + parent.invert (); + parent.transform_distance (ref x, ref y); + + cx -= x; + cy -= y; + } } }