Merge branch 'stroke-join'

This commit is contained in:
Taco de Wolff 2017-05-21 21:02:09 +02:00
commit d5d7d22cd8

View file

@ -438,12 +438,19 @@ func (k *stroker) stroke(q Path) {
if len(k.r) == 0 {
return
}
// TODO(nigeltao): if q is a closed curve then we should join the first and
// last segments instead of capping them.
k.cr.Cap(k.p, k.u, q.lastPoint(), pNeg(k.anorm))
closed := q.firstPoint() == q.lastPoint()
if !closed {
k.cr.Cap(k.p, k.u, q.lastPoint(), pNeg(k.anorm))
} else {
pivot := q.firstPoint()
k.jr.Join(k.p, &k.r, k.u, pivot, k.anorm, pivot.Sub(fixed.Point26_6{k.r[1], k.r[2]}))
}
addPathReversed(k.p, k.r)
pivot := q.firstPoint()
k.cr.Cap(k.p, k.u, pivot, pivot.Sub(fixed.Point26_6{k.r[1], k.r[2]}))
if !closed {
pivot := q.firstPoint()
k.cr.Cap(k.p, k.u, pivot, pivot.Sub(fixed.Point26_6{k.r[1], k.r[2]}))
}
}
// Stroke adds q stroked with the given width to p. The result is typically