The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Add cubic line

These changes was commited to the Birdfont repository Fri, 29 Jul 2016 09:56:48 +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>
Fri, 29 Jul 2016 09:56:48 +0000 (11:56 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Fri, 29 Jul 2016 09:56:48 +0000 (11:56 +0200)
commit 43737f75d9a66da88a1e7b3dddc20d7cbef51051
tree 9deb60901a776a639ba6f53cbda1ce87c8a32b84
parent 930ed3d23ffa6d1a3c3d4801c4d6c463ee8ba381
Add cubic line

libsvgbird/Points.vala
--- a/libsvgbird/Points.vala +++ b/libsvgbird/Points.vala @@ -50,6 +50,36 @@ public void add_type (uchar type) { point_data.add_type (type); + } + + public int add_cubic (double handle_x, double handle_y, + double next_handle_x, double next_handle_y, + double x, double y) { + + // end point + if (size == 0) { + add_type (POINT_LINE); + add (x); + add (y); + add (0); + add (0); + add (0); + add (0); + add (0); + } + + int index = size - 8; + + insert_type (index, POINT_CUBIC); + insert (index + 1, handle_x); + insert (index + 2, handle_y); + insert (index + 3, next_handle_x); + insert (index + 4, next_handle_y); + insert (index + 5, x); + insert (index + 6, y); + insert (index + 7, 0); + + return index; } public Points copy () {