From 7a2b8a54b9e637bc1ee3f13f567f1676089ef835 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 22 Sep 2021 07:21:26 -0400 Subject: graphics: path: Add flip-horizontal and flip-vertical procedures. --- chickadee/graphics/path.scm | 8 ++++++++ doc/api.texi | 8 ++++++++ 2 files changed, 16 insertions(+) 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}. -- cgit v1.2.3