/[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.11 by jvk, Tue Oct 15 08:28:36 2002 UTC revision 1.12 by jvk, Tue Oct 15 11:35:53 2002 UTC
# Line 117  def LABclamp(rgb): Line 117  def LABclamp(rgb):
117    
118    
119  # The YST color space below is a linear color space with  # The YST color space below is a linear color space with
120  # a lightness component and a color plane vector whose angle and  # a luminance component and a color plane vector whose angle and
121  # radius specify the hue and saturation, respectively.  # radius specify the hue and saturation, respectively.
122  # Opposite colors are 180 degrees apart.  # Opposite colors are 180 degrees apart.
123  #  #
124  # The Y component is the CIE Y lightness (but the weights can be changed) and  # The Y component is the CIE Y luminance (but the weights can be changed) and
125  # the ST-plane has the RGB primaries 120 (R = 0, G = 120, B = 240) degrees apart  # the ST-plane has the RGB primaries 120 (R = 0, G = 120, B = 240) degrees apart
126  # at radius 1.  # at radius 1.
127  #      #    
128  # Lightness weights of the RGB primaries used in YST color space functions  # Luminance weights of the RGB primaries used in YST color space functions
129  Wr = 0.212671  Wr = 0.212671
130  Wg = 0.715160  Wg = 0.715160
131  Wb = 0.072169  Wb = 0.072169
# Line 186  def YSThue(RGB): Line 186  def YSThue(RGB):
186  def YtoL(Y):  def YtoL(Y):
187      """      """
188      Convert linear luminance into perceptual lightness (CIE L*)      Convert linear luminance into perceptual lightness (CIE L*)
189      Y: lightness between 0 and 1      Y: luminance between 0 and 1
190      returns: luminance between 0 and 100      returns: lightness between 0 and 100
191      """      """
192      if Y <= (216./24389):      if Y <= (216./24389):
193          return Y * (24389./27)          return Y * (24389./27)
# Line 197  def YtoL(Y): Line 197  def YtoL(Y):
197  def LtoY(L):  def LtoY(L):
198      """      """
199      Convert perceptual lightness (CIE L*) into linear luminance      Convert perceptual lightness (CIE L*) into linear luminance
200      L: luminance between 0 and 100      L: lightness between 0 and 100
201      returns: lightness between 0 and 1      returns: luminance between 0 and 1
202      """      """
203      if L <= 8:      if L <= 8:
204          return L * (27./24389)          return L * (27./24389)

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

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