author | Claus Gittinger <cg@exept.de> |
Thu, 23 Nov 1995 18:49:05 +0100 | |
changeset 129 | f890eaabc487 |
parent 114 | e577a2f332d0 |
child 214 | 28ed6be65f4c |
permissions | -rw-r--r-- |
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 class methodsFor:'documentation'! |
|
21 |
||
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
25 |
All Rights Reserved |
|
26 |
||
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
version |
|
114
e577a2f332d0
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
37 |
^ '$Header: /cvs/stx/stx/libview2/Attic/ClrValue.st,v 1.7 1995-11-11 16:04:21 cg Exp $' |
39 | 38 |
! |
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
ColorValue is provided for ST-80 compatibility. |
|
43 |
read the section on compatibility issues in the Color class's documentation. |
|
44 |
" |
|
45 |
! ! |
|
46 |
||
47 |
!ColorValue class methodsFor:'instance creation'! |
|
48 |
||
100 | 49 |
doesNotUnderstand:aMessage |
50 |
"catch other instance creation messages" |
|
51 |
||
52 |
|clr| |
|
53 |
||
54 |
(clr := self name:aMessage selector asString) notNil ifTrue:[ |
|
55 |
^ clr |
|
56 |
]. |
|
57 |
^ super doesNotUnderstand:aMessage |
|
58 |
||
59 |
" |
|
60 |
ColorValue royalBlue |
|
61 |
ColorValue funnyGreen |
|
62 |
" |
|
63 |
! ! |
|
64 |
||
65 |
!ColorValue class methodsFor:'instance creation'! |
|
66 |
||
39 | 67 |
red:r green:g blue:b |
47 | 68 |
"return a color from red, green and blue values. |
69 |
The arguments, r, g and b must be in the range (0..1)" |
|
39 | 70 |
|
71 |
^ Color red:r*100 green:g*100 blue:b*100 |
|
72 |
||
73 |
" |
|
74 |
ColorValue red:0 green:1 blue:0 |
|
75 |
" |
|
76 |
! |
|
77 |
||
47 | 78 |
brightness:grey |
79 |
"return a grey color. |
|
80 |
The grey value is given in 0..1 instead of percent" |
|
81 |
||
82 |
^ Color grey:(grey * 100) |
|
83 |
||
84 |
" |
|
85 |
ColorValue brightness:0.5 |
|
86 |
" |
|
87 |
! |
|
88 |
||
63 | 89 |
hue:hue saturation:sat brightness:light |
90 |
"return a color. |
|
91 |
The hue, saturation and brightness values are given in 0..1 instead of |
|
92 |
degrees / percent" |
|
93 |
||
94 |
^ Color hue:hue*360 light:light*100 saturation:sat*100 |
|
95 |
||
96 |
" |
|
97 |
ColorValue hue:0 saturation:1 brightness:0.5 |
|
98 |
" |
|
99 |
! |
|
100 |
||
39 | 101 |
scaledRed:r scaledGreen:g scaledBlue:b |
102 |
"ST-80 compatibility. |
|
103 |
Return a color from r, g and b values; |
|
104 |
the arguments, r, g and b are interpreted as 13bit |
|
105 |
direct value (0..8191); 0/0/0 is black, 8191/8191/8191 is white." |
|
106 |
||
107 |
^ Color red:(r * 100 / 8191) |
|
108 |
green:(g * 100 / 8191) |
|
109 |
blue:(b * 100 / 8191) |
|
110 |
||
111 |
" |
|
112 |
ColorValue scaledRed:8191 scaledGreen:8191 scaledBlue:8191 |
|
113 |
ColorValue scaledRed:0 scaledGreen:0 scaledBlue:0 |
|
114 |
ColorValue scaledRed:4092 scaledGreen:4092 scaledBlue:4092 |
|
115 |
" |
|
116 |
! ! |