summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2019-01-08 21:51:16 -0500
committerDavid Thompson <dthompson2@worcester.edu>2019-01-08 21:51:16 -0500
commitc42b3b404c15491a2032a0e11cef83e39b3470e3 (patch)
tree42d65ed2567c9f4dfc8811be28bf1f80e1cb66bb
parent48b81e45c2e043e5481b80695821ad2bbfcb6e62 (diff)
render: sprite: Allow nine patches to be tinted.
* chickadee/render/sprite.scm (draw-nine-patch*, draw-nine-patch): Add tint keyword argument. * doc/api.texi (Sprites): Document new argument.
-rw-r--r--chickadee/render/sprite.scm12
-rw-r--r--doc/api.texi3
2 files changed, 10 insertions, 5 deletions
diff --git a/chickadee/render/sprite.scm b/chickadee/render/sprite.scm
index 6b6cf2a..708cc78 100644
--- a/chickadee/render/sprite.scm
+++ b/chickadee/render/sprite.scm
@@ -434,7 +434,8 @@ BLEND-MODE."
(bottom-margin margin)
(left-margin margin)
(right-margin margin)
- (blend-mode 'alpha))
+ (blend-mode 'alpha)
+ (tint white))
(let* ((x (rect-x rect))
(y (rect-y rect))
(w (rect-width rect))
@@ -470,7 +471,8 @@ BLEND-MODE."
(set-rect-height! texcoords (- t2 t1))
(draw-sprite* texture %rect matrix
#:texcoords texcoords
- #:blend-mode blend-mode))
+ #:blend-mode blend-mode
+ #:tint tint))
(with-batched-sprites
;; bottom-left
(draw-piece border-x1 border-y1 fill-x1 fill-y1
@@ -513,7 +515,8 @@ BLEND-MODE."
(origin %null-vec2)
(rotation 0.0)
(scale %default-scale)
- (blend-mode 'alpha))
+ (blend-mode 'alpha)
+ (tint white))
"Draw a \"nine patch\" sprite. A nine patch sprite renders
TEXTURE on the rectangular area RECT whose stretchable areas are
defined by the given margin measurements. The corners are never
@@ -542,4 +545,5 @@ LEFT-MARGIN, and RIGHT-MARGIN arguments may be used."
#:bottom-margin bottom-margin
#:left-margin left-margin
#:right-margin right-margin
- #:blend-mode blend-mode))))
+ #:blend-mode blend-mode
+ #:tint tint))))
diff --git a/doc/api.texi b/doc/api.texi
index fc1f8dd..6669b5f 100644
--- a/doc/api.texi
+++ b/doc/api.texi
@@ -1411,7 +1411,8 @@ artifacts.
@deffn {Procedure} draw-nine-patch @var{texture} @var{rect} @
[#:margin 0] [#:top-margin margin] [#:bottom-margin margin] @
[#:left-margin margin] [#:right-margin margin] @
- [#:origin] [#:scale] [#:rotation] [#:blend-mode alpha]
+ [#:origin] [#:scale] [#:rotation] [#:blend-mode alpha] @
+ [#:tint white]
Draw a nine patch sprite. A nine patch sprite renders @var{texture}
as a @var{width} x @var{height} rectangle whose stretchable areas are