Color.st
changeset 4896 bd1f161a578a
parent 4851 c0a32100d99e
child 4908 bb534a1fc0e3
equal deleted inserted replaced
4895:7d8afb686dec 4896:bd1f161a578a
   933     "{ Pragma: +optSpace }"
   933     "{ Pragma: +optSpace }"
   934 
   934 
   935     "let user point on a screen pixel.
   935     "let user point on a screen pixel.
   936      Return an instance for that pixels color"
   936      Return an instance for that pixels color"
   937 
   937 
   938     |p img|
   938     ^ self fromUserWithFeedBack:nil
   939 
       
   940     p := Screen current pointFromUser.
       
   941     img := Image fromScreen:(p corner:p+1).
       
   942     ^ img colorAt:0@0
       
   943 
   939 
   944     "
   940     "
   945      Color fromUser
   941      Color fromUser
       
   942     "
       
   943 
       
   944     "Modified: / 31.8.1995 / 01:34:22 / claus"
       
   945     "Modified: / 9.1.1998 / 20:48:58 / stefan"
       
   946 !
       
   947 
       
   948 fromUserWithFeedBack:feedbackBlockOrNil
       
   949     "{ Pragma: +optSpace }"
       
   950 
       
   951     "let user point on a screen pixel.
       
   952      Return an instance for that pixels color"
       
   953 
       
   954     |p screen|
       
   955 
       
   956     screen := Screen current.
       
   957     p := screen 
       
   958             pointFromUserShowing:(Cursor crossHair)
       
   959             positionFeedback:[:p | 
       
   960                                 feedbackBlockOrNil notNil ifTrue:[
       
   961                                     feedbackBlockOrNil value:(screen colorAt:p)    
       
   962                                 ]
       
   963                             ].
       
   964     ^ screen colorAt:p
       
   965 
       
   966     "
       
   967      Color fromUserWithFeedBack:nil
   946     "
   968     "
   947 
   969 
   948     "Modified: / 31.8.1995 / 01:34:22 / claus"
   970     "Modified: / 31.8.1995 / 01:34:22 / claus"
   949     "Modified: / 9.1.1998 / 20:48:58 / stefan"
   971     "Modified: / 9.1.1998 / 20:48:58 / stefan"
   950 !
   972 !
  2004 
  2026 
  2005      ^ self cyan:100-yellow magenta:100-yellow yellow:100
  2027      ^ self cyan:100-yellow magenta:100-yellow yellow:100
  2006                                      
  2028                                      
  2007 ! !
  2029 ! !
  2008 
  2030 
       
  2031 
  2009 !Color class methodsFor:'obsolete'!
  2032 !Color class methodsFor:'obsolete'!
  2010 
  2033 
  2011 nameOrDither:colorName
  2034 nameOrDither:colorName
  2012     "return a named color - if the exact color is not available,
  2035     "return a named color - if the exact color is not available,
  2013      return a dithered color. Report an error, if the colorname is 
  2036      return a dithered color. Report an error, if the colorname is 
  5453 ! !
  5476 ! !
  5454 
  5477 
  5455 !Color class methodsFor:'documentation'!
  5478 !Color class methodsFor:'documentation'!
  5456 
  5479 
  5457 version
  5480 version
  5458     ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.208 2008-01-09 12:11:12 cg Exp $'
  5481     ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.209 2008-02-04 15:01:17 cg Exp $'
  5459 ! !
  5482 ! !
  5460 
  5483 
  5461 Color initialize!
  5484 Color initialize!