diff options
author | David Thompson <dthompson2@worcester.edu> | 2018-01-08 21:45:16 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2018-01-08 21:45:43 -0500 |
commit | 2756990be1e3191764336c1d7e74198f540f20bb (patch) | |
tree | 78688e5f84eb15ca2e66cbaa8bd852b7e17a4abf | |
parent | cf1b09a12f39767c1cdf2b9cee81c396dc8b52cd (diff) |
render: color: Add color-lerp procedure.
* chickadee/render/color.scm (color-lerp): New procedure.
-rw-r--r-- | chickadee/render/color.scm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/chickadee/render/color.scm b/chickadee/render/color.scm index 1480833..47ad769 100644 --- a/chickadee/render/color.scm +++ b/chickadee/render/color.scm @@ -1,5 +1,5 @@ ;;; Chickadee Game Toolkit -;;; Copyright © 2016 David Thompson <davet@gnu.org> +;;; Copyright © 2016, 2018 David Thompson <davet@gnu.org> ;;; ;;; Chickadee is free software: you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published @@ -96,6 +96,7 @@ ALPHA. ALPHA is clamped to the range [0, 1]." ;; (* (color-b a) (color-b b)) ;; (* (color-a a) (color-a b)))) +;; TODO: Optimize and inline (define color* (match-lambda* ((($ <color> r1 g1 b1 a1) ($ <color> r2 g2 b2 a2)) @@ -133,7 +134,9 @@ ALPHA. ALPHA is clamped to the range [0, 1]." (- 1 b) a)))) ; Do not alter alpha channel. -;;(define color-lerp (make-lerp color+ color*)) +(define-inlinable (color-lerp start end alpha) + (color+ (color* start (- 1.0 alpha)) + (color* end alpha))) ;;; ;;; Pre-defined Colors |