aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorGravatar Thomas B Thompson <tbent@spice.(none)>2011-01-04 00:04:05 -0500
committerGravatar Thomas B Thompson <tbent@spice.(none)>2011-01-04 00:04:05 -0500
commit134de4472d3f2fa913944770595de9221dd27fdf (patch)
treecf83e29a1ef4931a15f9b30125fedbd8fba8caf9 /util
parentf9aeaf10e3c9077504a78374640e79415734546b (diff)
worked on profiling, made a bunch of changes, huge speedup!
Diffstat (limited to 'util')
-rw-r--r--util/ColorOps.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/util/ColorOps.py b/util/ColorOps.py
index b0d64a7..da1e704 100644
--- a/util/ColorOps.py
+++ b/util/ColorOps.py
@@ -4,8 +4,16 @@ def randomColor():
def chooseRandomColor(colorList):
return random.choice(colorList)
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)))])
+ c[0] = c[0] if c[0] < 255 else 255
+ c[1] = c[1] if c[1] < 255 else 255
+ c[2] = c[2] if c[2] < 255 else 255
+ return c
+def combineColors(colors):
+ result = [0,0,0]
+ for c in colors:
+ result[0] += c[0]
+ result[1] += c[1]
+ result[2] += c[2]
+ return safeColor(result)
def multiplyColor(color, percent):
return safeColor([channel*(percent) for channel in color])