diff options
author | rcoh <rcoh@mit.edu> | 2011-01-04 10:43:21 -0500 |
---|---|---|
committer | rcoh <rcoh@mit.edu> | 2011-01-04 10:43:21 -0500 |
commit | dcc7afcea31c968575446b7f215d6780f747d7fb (patch) | |
tree | 52591d98be214371d96795f4995e637ce95d7759 /util | |
parent | f5c29b39f3eef83227e3fb7c550d9b2922a19894 (diff) | |
parent | 134de4472d3f2fa913944770595de9221dd27fdf (diff) |
Merge branch 'bens-cleanup' of github.com:rcoh/SmootLight
Conflicts:
operationscore/Input.py
pixelevents/DecayEvent.py
util/ColorOps.py
Diffstat (limited to 'util')
-rw-r--r-- | util/ColorOps.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/util/ColorOps.py b/util/ColorOps.py index 88a58a7..da1e704 100644 --- a/util/ColorOps.py +++ b/util/ColorOps.py @@ -4,16 +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)))]) -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] + 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]) |