mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 10:25:37 +00:00
op/clip: add absolute Path.ArcTo for completeness
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+9
-4
@@ -297,14 +297,12 @@ func (p *Path) QuadTo(ctrl, to f32.Point) {
|
|||||||
p.expand(to)
|
p.expand(to)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arc adds an elliptical arc to the path. The implied ellipse is defined
|
// ArcTo adds an elliptical arc to the path. The implied ellipse is defined
|
||||||
// by its focus points f1 and f2.
|
// by its focus points f1 and f2.
|
||||||
// The arc starts in the current point and ends angle radians along the ellipse boundary.
|
// The arc starts in the current point and ends angle radians along the ellipse boundary.
|
||||||
// The sign of angle determines the direction; positive being counter-clockwise,
|
// The sign of angle determines the direction; positive being counter-clockwise,
|
||||||
// negative clockwise.
|
// negative clockwise.
|
||||||
func (p *Path) Arc(f1, f2 f32.Point, angle float32) {
|
func (p *Path) ArcTo(f1, f2 f32.Point, angle float32) {
|
||||||
f1 = f1.Add(p.pen)
|
|
||||||
f2 = f2.Add(p.pen)
|
|
||||||
const segments = 16
|
const segments = 16
|
||||||
m := stroke.ArcTransform(p.pen, f1, f2, angle, segments)
|
m := stroke.ArcTransform(p.pen, f1, f2, angle, segments)
|
||||||
|
|
||||||
@@ -317,6 +315,13 @@ func (p *Path) Arc(f1, f2 f32.Point, angle float32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Arc is like ArcTo where f1 and f2 are relative to the current position.
|
||||||
|
func (p *Path) Arc(f1, f2 f32.Point, angle float32) {
|
||||||
|
f1 = f1.Add(p.pen)
|
||||||
|
f2 = f2.Add(p.pen)
|
||||||
|
p.ArcTo(f1, f2, angle)
|
||||||
|
}
|
||||||
|
|
||||||
// Cube records a cubic Bézier from the pen through
|
// Cube records a cubic Bézier from the pen through
|
||||||
// two control points ending in to.
|
// two control points ending in to.
|
||||||
func (p *Path) Cube(ctrl0, ctrl1, to f32.Point) {
|
func (p *Path) Cube(ctrl0, ctrl1, to f32.Point) {
|
||||||
|
|||||||
Reference in New Issue
Block a user