53 ! ! |
53 ! ! |
54 |
54 |
55 !Colormap class methodsFor:'instance creation'! |
55 !Colormap class methodsFor:'instance creation'! |
56 |
56 |
57 fromColors:aColorArray |
57 fromColors:aColorArray |
58 "given a collection of real colors, return a new instance |
58 "given a sequenceable collection of colors, return a new instance |
59 of myself" |
59 of myself" |
|
60 |
|
61 ^ self withColors:aColorArray |
|
62 |
|
63 " |
|
64 Colormap |
|
65 fromColors:(Array with:Color black |
|
66 with:Color red |
|
67 with:Color white) |
|
68 " |
|
69 |
|
70 "Modified: 25.2.1997 / 19:00:31 / cg" |
|
71 ! |
|
72 |
|
73 redVector:r greenVector:g blueVector:b |
|
74 "given vectors of red/green/and blue pixelValues, |
|
75 return a new instance of myself. |
|
76 The values must be in the range 0..255." |
|
77 |
|
78 ^ self new redVector:r greenVector:g blueVector:b |
|
79 |
|
80 " |
|
81 Colormap |
|
82 redVector:#[0 127 255] |
|
83 greenVector:#[0 127 255] |
|
84 blueVector:#[0 127 255] |
|
85 " |
|
86 |
|
87 "Modified: 23.4.1996 / 22:16:00 / cg" |
|
88 ! |
|
89 |
|
90 withColors:aColorArray |
|
91 "given a sequenceable collection of colors, return a new instance |
|
92 of myself. Renamed from #fromColors: for ST-80 compatibility." |
60 |
93 |
61 |n rV gV bV| |
94 |n rV gV bV| |
62 |
95 |
63 n := aColorArray size. |
96 n := aColorArray size. |
64 rV := ByteArray new:n. |
97 rV := ByteArray new:n. |
74 ]. |
107 ]. |
75 ^ self new redVector:rV greenVector:gV blueVector:bV |
108 ^ self new redVector:rV greenVector:gV blueVector:bV |
76 |
109 |
77 " |
110 " |
78 Colormap |
111 Colormap |
79 fromColors:(Array with:Color black |
112 withColors:(Array with:Color black |
80 with:Color red |
113 with:Color red |
81 with:Color white) |
114 with:Color white) |
82 " |
115 " |
83 |
116 |
84 "Modified: 23.4.1996 / 22:15:22 / cg" |
117 "Created: 25.2.1997 / 18:59:09 / cg" |
85 ! |
118 "Modified: 25.2.1997 / 19:00:35 / cg" |
86 |
|
87 redVector:r greenVector:g blueVector:b |
|
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 |
|
92 ^ self new redVector:r greenVector:g blueVector:b |
|
93 |
|
94 " |
|
95 Colormap |
|
96 redVector:#[0 127 255] |
|
97 greenVector:#[0 127 255] |
|
98 blueVector:#[0 127 255] |
|
99 " |
|
100 |
|
101 "Modified: 23.4.1996 / 22:16:00 / cg" |
|
102 ! ! |
119 ! ! |
103 |
120 |
104 !Colormap methodsFor:'accessing'! |
121 !Colormap methodsFor:'accessing'! |
105 |
122 |
106 at:index |
123 at:index |