aboutsummaryrefslogtreecommitdiff
path: root/util/ColorOps.py
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2010-12-29 12:43:05 -0500
committerGravatar rcoh <rcoh@mit.edu>2010-12-29 12:43:05 -0500
commitc8209d01f9ddf4c6670caee08073924cb33e447f (patch)
tree1e649deb239e56d8f5c5f95482bf78c70c393ebf /util/ColorOps.py
parentf9aeaf10e3c9077504a78374640e79415734546b (diff)
setting up some more behaviors to get inherited from
Diffstat (limited to 'util/ColorOps.py')
-rw-r--r--util/ColorOps.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/ColorOps.py b/util/ColorOps.py
index b0d64a7..88a58a7 100644
--- a/util/ColorOps.py
+++ b/util/ColorOps.py
@@ -7,5 +7,13 @@ def safeColor(c):
return [min(channel,255) for channel in c]
def combineColors(c1,c2):
return safeColor([c1[i]+c2[i] for i in range(min(len(c1),len(c2)))])
+def fastMultiply(color, percent, acc=100):
+ percent = int(percent*acc)
+ color = colorToInt(color)
+ color = [channel*percent for channel in color]
+
+def colorToInt(color):
+ return [int(channel) for channel in color]
def multiplyColor(color, percent):
+
return safeColor([channel*(percent) for channel in color])