ColorValue.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Apr 1996 18:24:25 +0200
changeset 220 4106d9ce7e02
parent 214 28ed6be65f4c
child 277 7833361c76a2
permissions -rw-r--r--
documentation

"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

Color subclass:#ColorValue
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Graphics-Support'
!

!ColorValue class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    ColorValue is provided for ST-80 compatibility.
    read the section on compatibility issues in the Color class's documentation.

    [author:]
        Claus Gittinger
"
! !

!ColorValue class methodsFor:'instance creation'!

brightness:grey
    "return a grey color.
     The grey value is given in 0..1 instead of percent"

    ^ Color grey:(grey * 100)

    "
     ColorValue brightness:0.5
    "
!

doesNotUnderstand:aMessage
    "catch other instance creation messages"

    |clr|

    (clr := self name:aMessage selector asString) notNil ifTrue:[
	^ clr
    ].
    ^ super doesNotUnderstand:aMessage

    "
     ColorValue royalBlue
     ColorValue funnyGreen
    "
!

hue:hue saturation:sat brightness:light 
    "return a color.
     The hue, saturation and brightness values are given in 0..1 instead of 
     degrees / percent"

    ^ Color hue:hue*360 light:light*100 saturation:sat*100 

    "
     ColorValue hue:0 saturation:1 brightness:0.5 
    "
!

red:r green:g blue:b
    "return a color from red, green and blue values.
     The arguments, r, g and b must be in the range (0..1)"

    ^ Color red:r*100 green:g*100 blue:b*100

    "
     ColorValue red:0 green:1 blue:0
    "
!

scaledRed:r scaledGreen:g scaledBlue:b
     "ST-80 compatibility.
      Return a color from r, g and b values;
      the arguments, r, g and b are interpreted as 13bit
      direct value (0..8191); 0/0/0 is black, 8191/8191/8191 is white."

    ^ Color red:(r * 100 / 8191)
	    green:(g * 100 / 8191)
	    blue:(b * 100 / 8191)

    "
     ColorValue scaledRed:8191 scaledGreen:8191 scaledBlue:8191
     ColorValue scaledRed:0 scaledGreen:0 scaledBlue:0 
     ColorValue scaledRed:4092 scaledGreen:4092 scaledBlue:4092 
    "
! !

!ColorValue class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libview2/ColorValue.st,v 1.9 1996-04-25 16:24:25 cg Exp $'
! !