author | Claus Gittinger <cg@exept.de> |
Sun, 27 Oct 1996 15:12:39 +0100 | |
changeset 1092 | 1b6391f333de |
parent 944 | 8d100ca5857c |
child 1351 | 6d5552229507 |
permissions | -rw-r--r-- |
91 | 1 |
" |
2 |
COPYRIGHT (c) 1994 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 |
||
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
13 |
SequenceableCollection subclass:#Colormap |
572 | 14 |
instanceVariableNames:'redVector greenVector blueVector' |
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
665 | 17 |
category:'Graphics-Images-Support' |
91 | 18 |
! |
19 |
||
1092 | 20 |
!Colormap class methodsFor:'documentation'! |
91 | 21 |
|
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1994 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 |
documentation |
|
37 |
" |
|
38 |
Colormaps are used with images (and Forms) to keep the byte-to-color |
|
39 |
mapping. |
|
602 | 40 |
Externally, either colors or pixel values can be accessed. |
91 | 41 |
Internally, the values are stored as 3 separate byte-arrays |
42 |
(i.e. individual components can be 0..255). |
|
602 | 43 |
This was done to avoid overhead due to allocation of many color |
44 |
instances. |
|
45 |
||
611 | 46 |
|
47 |
[author:] |
|
48 |
Claus Gittinger |
|
49 |
||
602 | 50 |
[see also:] |
603 | 51 |
Color Image Form |
91 | 52 |
" |
53 |
! ! |
|
54 |
||
1092 | 55 |
!Colormap class methodsFor:'instance creation'! |
91 | 56 |
|
118 | 57 |
fromColors:aColorArray |
602 | 58 |
"given a collection of real colors, return a new instance |
59 |
of myself" |
|
60 |
||
118 | 61 |
|n rV gV bV| |
62 |
||
63 |
n := aColorArray size. |
|
64 |
rV := ByteArray new:n. |
|
65 |
gV := ByteArray new:n. |
|
66 |
bV := ByteArray new:n. |
|
67 |
1 to:n do:[:i | |
|
602 | 68 |
|clr| |
118 | 69 |
|
602 | 70 |
clr := aColorArray at:i. |
71 |
rV at:i put:(clr red * 255 / 100) rounded. |
|
72 |
bV at:i put:(clr green * 255 / 100) rounded. |
|
73 |
gV at:i put:(clr blue * 255 / 100) rounded. |
|
118 | 74 |
]. |
75 |
^ self new redVector:rV greenVector:gV blueVector:bV |
|
76 |
||
77 |
" |
|
78 |
Colormap |
|
602 | 79 |
fromColors:(Array with:Color black |
80 |
with:Color red |
|
81 |
with:Color white) |
|
118 | 82 |
" |
602 | 83 |
|
84 |
"Modified: 23.4.1996 / 22:15:22 / cg" |
|
91 | 85 |
! |
86 |
||
87 |
redVector:r greenVector:g blueVector:b |
|
602 | 88 |
"given vectors of red/green/and blue pixelValues, |
89 |
return a new instance of myself. |
|
90 |
The values must be in the range 0..255." |
|
91 |
||
285 | 92 |
^ self new redVector:r greenVector:g blueVector:b |
91 | 93 |
|
285 | 94 |
" |
95 |
Colormap |
|
602 | 96 |
redVector:#[0 127 255] |
97 |
greenVector:#[0 127 255] |
|
98 |
blueVector:#[0 127 255] |
|
285 | 99 |
" |
602 | 100 |
|
101 |
"Modified: 23.4.1996 / 22:16:00 / cg" |
|
285 | 102 |
! ! |
91 | 103 |
|
285 | 104 |
!Colormap methodsFor:'accessing'! |
91 | 105 |
|
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
106 |
at:index |
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
107 |
"return the color for a index. |
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
108 |
Notice that index range is 1..." |
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
109 |
|
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
110 |
|r g b idx "{ Class: SmallInteger }" | |
91 | 111 |
|
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
112 |
idx := index. |
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
113 |
r := redVector at:idx. |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
114 |
g := greenVector at:idx. |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
115 |
b := blueVector at:idx. |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
116 |
|
91 | 117 |
^ Color |
808 | 118 |
red:(r * (100.0 / 255.0)) |
119 |
green:(g * (100.0 / 255.0)) |
|
120 |
blue:(b * (100.0 / 255.0)) |
|
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
121 |
|
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
122 |
"Created: 2.5.1996 / 12:21:40 / cg" |
808 | 123 |
"Modified: 8.6.1996 / 14:25:30 / cg" |
91 | 124 |
! |
125 |
||
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
126 |
at:index put:aColor |
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
127 |
"set the color for a index. Return aColor (sigh). |
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
128 |
Notice that index range is 1..." |
91 | 129 |
|
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
130 |
|r g b idx "{ Class: SmallInteger }" | |
572 | 131 |
|
91 | 132 |
r := (aColor red * 255 / 100) rounded. |
133 |
g := (aColor green * 255 / 100) rounded. |
|
134 |
b := (aColor blue * 255 / 100) rounded. |
|
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
135 |
|
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
136 |
idx := index. |
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
137 |
redVector at:idx put:r. |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
138 |
greenVector at:idx put:g. |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
139 |
blueVector at:idx put:b. |
572 | 140 |
^ aColor |
141 |
||
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
142 |
"Modified: 2.5.1996 / 17:29:29 / cg" |
118 | 143 |
! |
91 | 144 |
|
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
145 |
blueAt:index |
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
146 |
"return the blue component for some index. |
153 | 147 |
The returned value is scaled from the internal 0.. 255 to |
148 |
a percentage value 0..100" |
|
149 |
||
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
150 |
^ (blueVector at:index) * 100 / 255 |
285 | 151 |
|
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
152 |
"Modified: 2.5.1996 / 17:29:17 / cg" |
285 | 153 |
! |
154 |
||
155 |
colors |
|
156 |
"ST-80 compatibility: return a collection containing the colors I hold" |
|
157 |
||
158 |
^ self asArray |
|
153 | 159 |
! |
160 |
||
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
161 |
greenAt:index |
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
162 |
"return the green component for some index. |
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
163 |
The returned value is scaled from the internal 0.. 255 to |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
164 |
a percentage value 0..100" |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
165 |
|
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
166 |
^ (greenVector at:index) * 100 / 255 |
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
167 |
|
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
168 |
"Modified: 2.5.1996 / 17:29:36 / cg" |
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
169 |
! |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
170 |
|
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
171 |
redAt:index |
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
172 |
"return the red component for some index. |
153 | 173 |
The returned value is scaled from the internal 0.. 255 to |
174 |
a percentage value 0..100" |
|
175 |
||
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
176 |
^ (redVector at:index) * 100 / 255 |
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
177 |
|
637
08e099c202db
oops - had to undo 0-based indexing (some images use arrays as colormap)
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
178 |
"Modified: 2.5.1996 / 17:29:44 / cg" |
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
179 |
! |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
180 |
|
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
181 |
size |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
182 |
"return the number of colors in the receiver" |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
183 |
|
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
184 |
^ redVector size |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
185 |
|
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
186 |
"Modified: 23.4.1996 / 22:13:43 / cg" |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
187 |
! ! |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
188 |
|
1092 | 189 |
!Colormap methodsFor:'accessing-internals'! |
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
190 |
|
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
191 |
blueVector |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
192 |
"return the blueVector" |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
193 |
|
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
194 |
^ blueVector |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
195 |
|
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
196 |
"Modified: 2.5.1996 / 12:44:17 / cg" |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
197 |
! |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
198 |
|
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
199 |
blueVector:something |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
200 |
"set blueVector" |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
201 |
|
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
202 |
blueVector := something. |
153 | 203 |
! |
204 |
||
285 | 205 |
greenVector |
206 |
"return greenVector" |
|
207 |
||
208 |
^ greenVector |
|
209 |
! |
|
210 |
||
211 |
greenVector:something |
|
212 |
"set greenVector" |
|
213 |
||
214 |
greenVector := something. |
|
215 |
! |
|
216 |
||
217 |
redVector |
|
218 |
"return redVector" |
|
219 |
||
220 |
^ redVector |
|
153 | 221 |
! |
222 |
||
285 | 223 |
redVector:something |
224 |
"set redVector" |
|
153 | 225 |
|
285 | 226 |
redVector := something. |
227 |
! |
|
91 | 228 |
|
285 | 229 |
redVector:r greenVector:g blueVector:b |
602 | 230 |
"set the red, green and blueVectors" |
231 |
||
285 | 232 |
redVector := r. |
233 |
greenVector := g. |
|
234 |
blueVector := b. |
|
602 | 235 |
|
236 |
"Modified: 23.4.1996 / 22:13:31 / cg" |
|
91 | 237 |
! ! |
238 |
||
943 | 239 |
!Colormap methodsFor:'converting'! |
917
d0ab9a4e0344
postCopt must copy the vectors
Claus Gittinger <cg@exept.de>
parents:
808
diff
changeset
|
240 |
|
941 | 241 |
asArray |
944 | 242 |
"return the receiver as an array containing my colors" |
941 | 243 |
|
244 |
|r g b n "{ Class: SmallInteger }" |
|
245 |
scale array| |
|
246 |
||
247 |
n := redVector size. |
|
248 |
array := Array new:n. |
|
249 |
scale := Color scalingValue / 255.0. |
|
250 |
||
251 |
1 to:n do:[:idx | |
|
252 |
r := redVector at:idx. |
|
253 |
g := greenVector at:idx. |
|
254 |
b := blueVector at:idx. |
|
255 |
||
256 |
array at:idx put:(Color |
|
257 |
scaledRed:(r * scale) rounded |
|
258 |
scaledGreen:(g * scale) rounded |
|
259 |
scaledBlue:(b * scale) rounded) |
|
943 | 260 |
]. |
261 |
^ array |
|
941 | 262 |
|
263 |
"Created: 11.7.1996 / 20:19:45 / cg" |
|
944 | 264 |
"Modified: 11.7.1996 / 21:34:16 / cg" |
943 | 265 |
! ! |
266 |
||
267 |
!Colormap methodsFor:'copying'! |
|
941 | 268 |
|
917
d0ab9a4e0344
postCopt must copy the vectors
Claus Gittinger <cg@exept.de>
parents:
808
diff
changeset
|
269 |
postCopy |
d0ab9a4e0344
postCopt must copy the vectors
Claus Gittinger <cg@exept.de>
parents:
808
diff
changeset
|
270 |
redVector := redVector copy. |
d0ab9a4e0344
postCopt must copy the vectors
Claus Gittinger <cg@exept.de>
parents:
808
diff
changeset
|
271 |
greenVector := greenVector copy. |
d0ab9a4e0344
postCopt must copy the vectors
Claus Gittinger <cg@exept.de>
parents:
808
diff
changeset
|
272 |
blueVector := blueVector copy. |
d0ab9a4e0344
postCopt must copy the vectors
Claus Gittinger <cg@exept.de>
parents:
808
diff
changeset
|
273 |
|
d0ab9a4e0344
postCopt must copy the vectors
Claus Gittinger <cg@exept.de>
parents:
808
diff
changeset
|
274 |
"Created: 5.7.1996 / 14:52:15 / cg" |
d0ab9a4e0344
postCopt must copy the vectors
Claus Gittinger <cg@exept.de>
parents:
808
diff
changeset
|
275 |
! ! |
d0ab9a4e0344
postCopt must copy the vectors
Claus Gittinger <cg@exept.de>
parents:
808
diff
changeset
|
276 |
|
91 | 277 |
!Colormap methodsFor:'misc'! |
278 |
||
279 |
scaleValuesBy:scaleFactor |
|
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
280 |
"multiply all values by scaleFactor; finally round to integer. |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
281 |
This can be used to brighten/darken an images colormap" |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
282 |
|
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
283 |
|sz "{ Class: SmallInteger }" | |
91 | 284 |
|
635
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
285 |
sz := redVector size. |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
286 |
1 to:sz do:[:index | |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
287 |
redVector at:index put:((redVector at:index) * scaleFactor) rounded. |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
288 |
greenVector at:index put:((greenVector at:index) * scaleFactor) rounded. |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
289 |
blueVector at:index put:((blueVector at:index) * scaleFactor) rounded. |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
290 |
] |
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
291 |
|
1e1c3f870ba8
colorMap is now 0-index based (more compatibility with ST-80's Palette)
Claus Gittinger <cg@exept.de>
parents:
611
diff
changeset
|
292 |
"Modified: 2.5.1996 / 12:46:07 / cg" |
91 | 293 |
! ! |
285 | 294 |
|
773 | 295 |
!Colormap methodsFor:'storing'! |
296 |
||
297 |
storeOn:aStream |
|
298 |
"append a representation to aStream, from which the receiver |
|
299 |
can be reconstructed" |
|
300 |
||
301 |
aStream nextPutAll:'(' , self class name ,' redVector:'. |
|
302 |
redVector storeOn:aStream. |
|
303 |
aStream nextPutAll:' greenVector:'. |
|
304 |
greenVector storeOn:aStream. |
|
305 |
aStream nextPutAll:' blueVector:'. |
|
306 |
blueVector storeOn:aStream. |
|
307 |
aStream nextPutAll:')' |
|
308 |
||
309 |
"Created: 30.5.1996 / 16:28:27 / ca" |
|
310 |
"Modified: 30.5.1996 / 16:32:44 / ca" |
|
311 |
! ! |
|
312 |
||
1092 | 313 |
!Colormap class methodsFor:'documentation'! |
285 | 314 |
|
315 |
version |
|
1092 | 316 |
^ '$Header: /cvs/stx/stx/libview/Colormap.st,v 1.20 1996-10-27 14:12:04 cg Exp $' |
285 | 317 |
! ! |