/[gzz]/gzz/gfx/libpaper/colors.py
ViewVC logotype

Diff of /gzz/gfx/libpaper/colors.py

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

revision 1.15 by jvk, Mon Oct 14 17:49:30 2002 UTC revision 1.16 by jvk, Tue Oct 15 08:28:36 2002 UTC
# Line 1  Line 1 
1  # Choosing colors and 3-dotproduct factors for papers.  # Choosing colors and 3-dotproduct factors for papers.
2    
3  from gfx.libcolor.spaces import getRandomColor,getRandomColor2,YSTtoRGB,clampSat  from gfx.libcolor.spaces import getRandomColor,getRandomColor2,YSTtoRGB,clampSat,LtoY
4  from gfx.libcolor.spaces import RGBtoLAB,LABtoRGB,LABclamp  from gfx.libcolor.spaces import RGBtoLAB,LABtoRGB,LABclamp
5    
6  from math import sin,cos,atan2,pi,log  from math import sin,cos,atan2,pi,log
# Line 58  class Colors: Line 58  class Colors:
58                  for i in range(0, colors)]                  for i in range(0, colors)]
59    
60          # Construct colors and clamp to RGB cube keeping hue and luminance constant          # Construct colors and clamp to RGB cube keeping hue and luminance constant
61          yst = [(pow((lums[i] + 16.0) / 116, 3),          yst = [ ( LtoY(lums[i]),
62                  sats[i] * cos(hues[i]*pi/180),                    sats[i] * cos(hues[i]*pi/180),
63                  sats[i] * sin(hues[i]*pi/180))                    sats[i] * sin(hues[i]*pi/180) )
64                 for i in range(0,colors)]                  for i in range(0,colors)]
65                                        
66          col = [clampSat(YSTtoRGB(c)) for c in yst]          col = [clampSat(YSTtoRGB(c)) for c in yst]
67          shuffle(col, rnd.nextDouble)          shuffle(col, rnd.nextDouble)

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

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