summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/graphics/path.scm12
-rw-r--r--doc/api.texi8
2 files changed, 20 insertions, 0 deletions
diff --git a/chickadee/graphics/path.scm b/chickadee/graphics/path.scm
index 27eb0b1..c4e2b89 100644
--- a/chickadee/graphics/path.scm
+++ b/chickadee/graphics/path.scm
@@ -56,6 +56,7 @@
arc-to
line
polyline
+ bezier-path
rectangle
square
rounded-rectangle
@@ -361,6 +362,17 @@
(line-to p2)
(map line-to prest)))
+(define (bezier-path p1 c1 c2 p2 . points)
+ (apply path
+ (move-to p1)
+ (bezier-to c1 c2 p2)
+ (let loop ((points points))
+ (match points
+ (() '())
+ ((c1 c2 p . rest)
+ (cons (bezier-to c1 c2 p)
+ (loop rest)))))))
+
(define (rectangle bottom-left width height)
(let ((x (vec2-x bottom-left))
(y (vec2-y bottom-left)))
diff --git a/doc/api.texi b/doc/api.texi
index 87ff7cd..9a36bc4 100644
--- a/doc/api.texi
+++ b/doc/api.texi
@@ -2106,6 +2106,14 @@ Return a path that draws a straight line from @var{start} to @var{end}.
Return a path that draws a series of lines connecting @var{points}.
@end deffn
+@deffn {Procedure} bezier-path p1 c1 c2 p2 . points
+Return a path that draws a series of bezier points starting at
+@var{p1}, moving to @var{p2} using control points @var{c1} and
+@var{c2}, and proceeding to draw additional bezier curves as defined
+by @var{points}. Each additional curve requires 3 additional
+arguments: two control points and and an ending point.
+@end deffn
+
@deffn {Procedure} rectangle bottom-left width height
Return a path that draws a rectangle whose bottom-left corner is at
@var{bottom-left} and whose size is defined by @var{width} and