summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-09-22 07:29:32 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-09-22 07:30:57 -0400
commitd297c59ce2538b2f88d808346e8b9bbea2848e7d (patch)
tree6c4d91059efacfc0561fec346ecf2ad7f19e5c89
parent7a2b8a54b9e637bc1ee3f13f567f1676089ef835 (diff)
graphics: path: Add square-limit procedure.
-rw-r--r--chickadee/graphics/path.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/chickadee/graphics/path.scm b/chickadee/graphics/path.scm
index 83b50bf..ee501ce 100644
--- a/chickadee/graphics/path.scm
+++ b/chickadee/graphics/path.scm
@@ -88,6 +88,7 @@
right-split
up-split
corner-split
+ square-limit
painter?
painter-bounding-box
make-empty-canvas
@@ -1503,6 +1504,17 @@
(below (below right-small right-small)
(corner-split smaller (- n 1)))))))
+(define (square-limit painter n)
+ (if (<= n 0)
+ painter
+ (let* ((smaller (scale 0.5 painter))
+ (split (corner-split smaller n))
+ (flipped (vertical-flip split)))
+ (below (beside (rotate pi split)
+ (horizontal-flip (rotate pi split)))
+ (beside (horizontal-flip split)
+ split)))))
+
(define-record-type <canvas>
(%make-canvas matrix compiled-path filled-path-pool stroked-path-pool
tesselated-paths)