The Birdfont Source Code


All Repositories / birdfont.git / blob – RSS feed

BezierPoints.vala in /libsvgbird

This file is a part of the Birdfont project.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
Circle boundaries heads/master
1 /* 2 Copyright (C) 2014 2016 Johan Mattsson 3 4 This library is free software; you can redistribute it and/or modify 5 it under the terms of the GNU Lesser General Public License as 6 published by the Free Software Foundation; either version 3 of the 7 License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, but 10 WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 */ 14 15 namespace SvgBird { 16 17 /** Bezier point container for the SVG parser. */ 18 public class BezierPoints { 19 public unichar type = '\0'; 20 public unichar svg_type = '\0'; 21 public double x0 = 0; 22 public double y0 = 0; 23 public double x1 = 0; 24 public double y1 = 0; 25 public double x2 = 0; 26 public double y2 = 0; 27 28 // arc arguments 29 public double rx = 0; 30 public double ry = 0; 31 public double rotation = 0; 32 public bool large_arc = false; 33 public bool sweep = false; 34 // the arc instructions begins at x0, y0 and ends at x1, x1 35 36 public string to_string () { 37 if (svg_type == 'A' || svg_type == 'a') { 38 return @"SVG type:$((!) svg_type.to_string ()) $x0,$y0 $x1,$y1 rx=$rx, ry=$ry, rotation=$rotation, large_arc=$large_arc, sweep=$sweep)"; 39 } 40 41 return @"$((!)type.to_string ()) $x0,$y0 $x1,$y1 $x2,$y2 SVG:$((!)svg_type.to_string ())"; 42 } 43 } 44 45 } 46