diff options
author | David Thompson <dthompson2@worcester.edu> | 2021-09-22 07:21:26 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2021-09-22 07:30:57 -0400 |
commit | 7a2b8a54b9e637bc1ee3f13f567f1676089ef835 (patch) | |
tree | d1cc316d3928a98387f45d860eee94fb633c1e49 | |
parent | a700f36d804e9c6c64bdb4aa00bd7a039f3f553e (diff) |
graphics: path: Add flip-horizontal and flip-vertical procedures.
-rw-r--r-- | chickadee/graphics/path.scm | 8 | ||||
-rw-r--r-- | doc/api.texi | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/chickadee/graphics/path.scm b/chickadee/graphics/path.scm index 3b29b19..83b50bf 100644 --- a/chickadee/graphics/path.scm +++ b/chickadee/graphics/path.scm @@ -79,6 +79,8 @@ translate rotate scale + horizontal-flip + vertical-flip superimpose pad beside @@ -1411,6 +1413,12 @@ (define (scale x painter) (transform (matrix3-scale x) painter)) +(define (horizontal-flip painter) + (scale (vec2 -1.0 1.0) painter)) + +(define (vertical-flip painter) + (scale (vec2 1.0 -1.0) painter)) + (define (pad pad-x pad-y painter) (make-painter (painter-commands painter) (rect-inflate (painter-bounding-box painter) pad-x pad-y))) diff --git a/doc/api.texi b/doc/api.texi index 75d8b37..3329025 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -2329,6 +2329,14 @@ Rotate @var{painter} by @var{angle} radians. Scale @var{painter} by the scalar @var{x}. @end deffn +@deffn {Procedure} horizontal-flip painter +Flip @var{painter} horizontally. +@end deffn + +@deffn {Procedure} vertical-flip painter +Flip @var{painter} vertically. +@end deffn + @deffn {Procedure} pad pad-x pad-y painter Add @var{pad-x} and @var{pad-y} amount of empty space around @var{painter}. |