39
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
Color subclass:#ColorValue
|
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Graphics-Support'
|
|
18 |
!
|
|
19 |
|
|
20 |
ColorValue comment:'
|
|
21 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
22 |
All Rights Reserved
|
|
23 |
|
47
|
24 |
$Header: /cvs/stx/stx/libview2/ColorValue.st,v 1.2 1995-03-07 21:54:53 claus Exp $
|
39
|
25 |
'!
|
|
26 |
|
|
27 |
!ColorValue class methodsFor:'documentation'!
|
|
28 |
|
|
29 |
copyright
|
|
30 |
"
|
|
31 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
32 |
All Rights Reserved
|
|
33 |
|
|
34 |
This software is furnished under a license and may be used
|
|
35 |
only in accordance with the terms of that license and with the
|
|
36 |
inclusion of the above copyright notice. This software may not
|
|
37 |
be provided or otherwise made available to, or used by, any
|
|
38 |
other person. No title to or ownership of the software is
|
|
39 |
hereby transferred.
|
|
40 |
"
|
|
41 |
!
|
|
42 |
|
|
43 |
version
|
|
44 |
"
|
47
|
45 |
$Header: /cvs/stx/stx/libview2/ColorValue.st,v 1.2 1995-03-07 21:54:53 claus Exp $
|
39
|
46 |
"
|
|
47 |
!
|
|
48 |
|
|
49 |
documentation
|
|
50 |
"
|
|
51 |
ColorValue is provided for ST-80 compatibility.
|
|
52 |
read the section on compatibility issues in the Color class's documentation.
|
|
53 |
"
|
|
54 |
! !
|
|
55 |
|
|
56 |
!ColorValue class methodsFor:'instance creation'!
|
|
57 |
|
|
58 |
red:r green:g blue:b
|
47
|
59 |
"return a color from red, green and blue values.
|
|
60 |
The arguments, r, g and b must be in the range (0..1)"
|
39
|
61 |
|
|
62 |
^ Color red:r*100 green:g*100 blue:b*100
|
|
63 |
|
|
64 |
"
|
|
65 |
ColorValue red:0 green:1 blue:0
|
|
66 |
"
|
|
67 |
!
|
|
68 |
|
47
|
69 |
brightness:grey
|
|
70 |
"return a grey color.
|
|
71 |
The grey value is given in 0..1 instead of percent"
|
|
72 |
|
|
73 |
^ Color grey:(grey * 100)
|
|
74 |
|
|
75 |
"
|
|
76 |
ColorValue brightness:0.5
|
|
77 |
"
|
|
78 |
!
|
|
79 |
|
39
|
80 |
scaledRed:r scaledGreen:g scaledBlue:b
|
|
81 |
"ST-80 compatibility.
|
|
82 |
Return a color from r, g and b values;
|
|
83 |
the arguments, r, g and b are interpreted as 13bit
|
|
84 |
direct value (0..8191); 0/0/0 is black, 8191/8191/8191 is white."
|
|
85 |
|
|
86 |
^ Color red:(r * 100 / 8191)
|
|
87 |
green:(g * 100 / 8191)
|
|
88 |
blue:(b * 100 / 8191)
|
|
89 |
|
|
90 |
"
|
|
91 |
ColorValue scaledRed:8191 scaledGreen:8191 scaledBlue:8191
|
|
92 |
ColorValue scaledRed:0 scaledGreen:0 scaledBlue:0
|
|
93 |
ColorValue scaledRed:4092 scaledGreen:4092 scaledBlue:4092
|
|
94 |
"
|
|
95 |
! !
|