107 |
107 |
108 listOfColorMaps |
108 listOfColorMaps |
109 "returns the list of default color maps for a new image" |
109 "returns the list of default color maps for a new image" |
110 |
110 |
111 |colorMap| |
111 |colorMap| |
|
112 |
112 (colorMap := OrderedCollection new) |
113 (colorMap := OrderedCollection new) |
113 add: Color black; |
114 add: Color black; |
114 add: Color white; |
115 add: Color white; |
115 add: Color red; |
116 add: Color red; |
116 add: Color green; |
117 add: Color green; |
117 add: Color blue; |
118 add: Color blue; |
118 add: Color cyan; |
119 add: Color cyan; |
119 add: Color yellow; |
120 add: Color yellow; |
120 add: Color magenta; |
121 add: Color magenta; |
121 add: (Color red: 50 green: 0 blue: 0); |
122 add: (Color redByte: 127 greenByte: 0 blueByte: 0); |
122 add: (Color red: 0 green: 50 blue: 0); |
123 add: (Color redByte: 0 greenByte: 127 blueByte: 0); |
123 add: (Color red: 0 green: 0 blue: 50); |
124 add: (Color redByte: 0 greenByte: 0 blueByte: 127); |
124 add: (Color red: 0 green: 50 blue: 50); |
125 add: (Color redByte: 0 greenByte: 127 blueByte: 127); |
125 add: (Color red: 50 green: 50 blue: 0); |
126 add: (Color redByte: 127 greenByte: 127 blueByte: 0); |
126 add: (Color red: 50 green: 0 blue: 50); |
127 add: (Color redByte: 127 greenByte: 0 blueByte: 127); |
127 add: Color gray; |
128 add: (Color redByte: 127 greenByte: 127 blueByte: 127); |
128 add: Color lightGray. |
129 add: (Color redByte: 170 greenByte: 170 blueByte: 170). |
|
130 |
129 0 to: 5 do: |
131 0 to: 5 do: |
130 [:r| |
132 [:r| |
131 0 to: 5 do: |
133 0 to: 5 do: |
132 [:g| |
134 [:g| |
133 0 to: 5 do: |
135 0 to: 5 do: |
134 [:b| |
136 [:b| |
135 colorMap add: (Color red: (r*100//5) ceiling green: (g*100//5) ceiling blue: (b*100//5) ceiling) |
137 colorMap add: (Color redByte: (r*255//5) ceiling greenByte: (g*255//5) ceiling blueByte: (b*255//5) ceiling) |
136 ] |
138 ] |
137 ] |
139 ] |
138 ]. |
140 ]. |
139 |
141 |
140 1 to: 25 do: |
142 1 to: 25 do: |
141 [:g| |
143 [:g| |
142 colorMap add: (Color gray: (g*100//26) ceiling) |
144 colorMap add: (Color redByte: (g*255//26) ceiling greenByte: (g*255//26) ceiling blueByte: (g*255//26) ceiling) |
143 ]. |
145 ]. |
144 |
146 |
145 ^Dictionary new |
147 ^Dictionary new |
146 at: '8-plane' put: colorMap; |
148 at: '8-plane' put: colorMap; |
147 at: '8-plane + mask' put: colorMap; |
149 at: '8-plane + mask' put: colorMap; |
1118 ifTrue: |
1120 ifTrue: |
1119 [ |
1121 [ |
1120 self colorMapMode: colorMapMode value: nil |
1122 self colorMapMode: colorMapMode value: nil |
1121 ]. |
1123 ]. |
1122 self imageEditView selectColors: (Array with: (self listOfColors at: 1) with: (self listOfColors at: 2 ifAbsent: [self listOfColors at: 1])). |
1124 self imageEditView selectColors: (Array with: (self listOfColors at: 1) with: (self listOfColors at: 2 ifAbsent: [self listOfColors at: 1])). |
1123 (self image mask notNil and: [(self listOfColors includes: (Color basicNew setColorId:0)) not]) |
1125 |
|
1126 self image mask notNil |
1124 ifTrue: |
1127 ifTrue: |
1125 [ |
1128 [ |
1126 colorMapMode := colorMapMode, ' + mask'. |
1129 colorMapMode := colorMapMode, ' + mask'. |
1127 self listOfColors addFirst: (Color basicNew setColorId:0). |
1130 (self listOfColors detect: [:clr| clr = (Color basicNew setColorId:0)] ifNone: nil) isNil |
1128 self imageEditView selectColors: (Array with: (self listOfColors at: 2 ifAbsent: [self listOfColors at: 1]) with: (self listOfColors at: 1)). |
1131 ifTrue: |
|
1132 [ |
|
1133 self listOfColors addFirst: (Color basicNew setColorId:0). |
|
1134 self imageEditView selectColors: (Array with: (self listOfColors at: 2 ifAbsent: [self listOfColors at: 1]) with: (self listOfColors at: 1)). |
|
1135 ] |
1129 ]. |
1136 ]. |
1130 self selectionOfColor value: 0. |
1137 self selectionOfColor value: 0. |
1131 self selectionOfColor value: (self listOfColors indexOf: self imageEditView selectedColor). |
1138 self selectionOfColor value: (self listOfColors indexOf: self imageEditView selectedColor). |
1132 ! |
1139 ! |
1133 |
1140 |