Color.st
changeset 5131 95d91d6d649c
parent 5127 40d2ac51c76d
child 5144 d93391e9ea8d
equal deleted inserted replaced
5130:0bc49bea4bab 5131:95d91d6d649c
   988     "return a color from hue, light and saturation values.
   988     "return a color from hue, light and saturation values.
   989      Hue is in degrees (0..360); light and sturation are
   989      Hue is in degrees (0..360); light and sturation are
   990      in percent (0..100)"
   990      in percent (0..100)"
   991 
   991 
   992     self withRGBFromHue:h light:l saturation:s do:[:r :g :b |
   992     self withRGBFromHue:h light:l saturation:s do:[:r :g :b |
   993         ^ self redPercent:(r min:100) greenPercent:(g min:100) bluePercent:(b min:100)
   993         ^ self 
       
   994             redPercent:(r clampBetween:0 and:100) 
       
   995             greenPercent:(g clampBetween:0 and:100) 
       
   996             bluePercent:(b clampBetween:0 and:100)
   994     ]
   997     ]
   995 
   998 
   996     "
   999     "
   997      Color hue:0 light:50 saturation:100     - red
  1000      Color hue:0 light:50 saturation:100     - red
   998      Color hue:60 light:50 saturation:100    - yellow
  1001      Color hue:60 light:50 saturation:100    - yellow
  4372 
  4375 
  4373     "Modified: 11.6.1996 / 17:20:07 / cg"
  4376     "Modified: 11.6.1996 / 17:20:07 / cg"
  4374     "Created: 11.6.1996 / 18:30:20 / cg"
  4377     "Created: 11.6.1996 / 18:30:20 / cg"
  4375 ! !
  4378 ! !
  4376 
  4379 
       
  4380 
  4377 !Color methodsFor:'comparing'!
  4381 !Color methodsFor:'comparing'!
  4378 
  4382 
  4379 = aColor
  4383 = aColor
  4380     "two colors are considered equal, if the color components are;
  4384     "two colors are considered equal, if the color components are;
  4381      independent of the device, the color is on"
  4385      independent of the device, the color is on"
  5529 ! !
  5533 ! !
  5530 
  5534 
  5531 !Color class methodsFor:'documentation'!
  5535 !Color class methodsFor:'documentation'!
  5532 
  5536 
  5533 version
  5537 version
  5534     ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.214 2008-12-02 20:24:14 cg Exp $'
  5538     ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.215 2008-12-03 16:42:03 cg Exp $'
  5535 ! !
  5539 ! !
  5536 
  5540 
  5537 Color initialize!
  5541 Color initialize!