summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-06-29 17:50:33 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-06-29 17:50:33 -0400
commita5c0e784b54d4c433209a99789950d6e156548aa (patch)
tree2c202402cecce75413478ec95f0a486c077ea52b
parenta836ff8926768d7ab4393fc4b99344515d681814 (diff)
Add color-scale procedure.
* sly/color.scm (color-scale): New procedure.
-rw-r--r--sly/color.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/sly/color.scm b/sly/color.scm
index c8ba248..3384510 100644
--- a/sly/color.scm
+++ b/sly/color.scm
@@ -36,6 +36,7 @@
rgba
rgb
color*
+ color-scale
color+
color-
color-inverse
@@ -128,6 +129,13 @@ For example: #xffffff will return a color with RGBA values 1, 1, 1,
(* (color-a a)
(color-a b))))
+(define (color-scale c k)
+ "Multiple the RGBA channels of the color C by the scalar K."
+ (make-color (* (color-r c) k)
+ (* (color-g c) k)
+ (* (color-b c) k)
+ (* (color-a c) k)))
+
(define (color+ a b)
"Add the RGBA channels of colors A and B."
(make-color (+ (color-r a)