/[gzz]/gzz/gfx/libcolor/spaces.py
ViewVC logotype

Diff of /gzz/gfx/libcolor/spaces.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by jvk, Tue Sep 24 13:09:24 2002 UTC revision 1.6 by jvk, Wed Sep 25 11:28:11 2002 UTC
# Line 77  def getRandomColor2(minL, maxL, rnd): Line 77  def getRandomColor2(minL, maxL, rnd):
77      a = 100 * math.cos(ang)      a = 100 * math.cos(ang)
78      b = 100 * math.sin(ang)      b = 100 * math.sin(ang)
79      rgb = LABtoRGB([L,a,b])      rgb = LABtoRGB([L,a,b])
80    
81        return LABclamp(rgb)
82    
83    def LABclamp(rgb):
84        """Clamp a RGB color into [0,1]^3 towards the CIELAB L-axis
85    
86        rgb: the color in RGB709
87        returns: the clamped color in RGB709
88        """
89      if len(filter((lambda x: x<0 or x>1), rgb)) == 0:      if len(filter((lambda x: x<0 or x>1), rgb)) == 0:
90          return rgb          return rgb
91    
92        (L,a,b) = RGBtoLAB(rgb)
93    
94      r = 0      r = 0
95      bit = .5      bit = .5
96      for iter in range(0,10):      for iter in range(0,10):
# Line 88  def getRandomColor2(minL, maxL, rnd): Line 99  def getRandomColor2(minL, maxL, rnd):
99              r = r + bit              r = r + bit
100          bit = bit * .5          bit = bit * .5
101      return LABtoRGB([L,r*a,r*b])      return LABtoRGB([L,r*a,r*b])
102        
   

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26