Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tacanvas.py
diff options
context:
space:
mode:
Diffstat (limited to 'TurtleArt/tacanvas.py')
-rw-r--r--TurtleArt/tacanvas.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py
index 1272b6b..1aac790 100644
--- a/TurtleArt/tacanvas.py
+++ b/TurtleArt/tacanvas.py
@@ -49,18 +49,10 @@ def wrap100(n):
def calc_shade(c, s, invert=False):
''' Convert a color to the current shade (lightness/darkness). '''
# Assumes 16 bit input values
- '''
if invert:
- if s < 0:
- return int(c / (1 + s * 0.8))
- return int((c - 65536 * s * 0.9) / (1 - (s * 0.9)))
- else:
- if s < 0:
- return int(c * (1 + s * 0.8))
- return int(c + (65536 - c) * s * 0.9)
- '''
- if invert:
- if s < 0:
+ if s == -1:
+ return int(c)
+ elif s < 0:
return int(c / (1 + s))
return int((c - 65536 * s) / (1 - s))
else:
@@ -73,10 +65,10 @@ def calc_gray(c, g, invert=False):
''' Gray is a psuedo saturation calculation. '''
# Assumes 16 bit input values
if g == 100:
- return c
+ return int(c)
if invert:
if g == 0:
- return c
+ return int(c)
else:
return int(((c * 100) - (32768 * (100 - g))) / g)
else: