From 2756990be1e3191764336c1d7e74198f540f20bb Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 8 Jan 2018 21:45:16 -0500 Subject: render: color: Add color-lerp procedure. * chickadee/render/color.scm (color-lerp): New procedure. --- chickadee/render/color.scm | 7 +++++-- 1 file 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 +;;; Copyright © 2016, 2018 David Thompson ;;; ;;; 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* ((($ r1 g1 b1 a1) ($ 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 -- cgit v1.2.3