author | Claus Gittinger <cg@exept.de> |
Mon, 13 Nov 2000 12:14:23 +0100 | |
changeset 1426 | fcf2ecbdde67 |
parent 1424 | d7367ae7f85e |
child 1433 | df38b2a5d335 |
permissions | -rw-r--r-- |
400 | 1 |
" |
767 | 2 |
COPYRIGHT (c) 1997-1998 by eXept Software AG |
400 | 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 |
|
405 | 7 |
inclusion of the above copyright notice. This software may not |
400 | 8 |
be provided or otherwise made available to, or used by, any |
405 | 9 |
other person. No title to or ownership of the software is |
400 | 10 |
hereby transferred. |
11 |
" |
|
12 |
||
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
13 |
"{ Package: 'stx:libtool2' }" |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
14 |
|
400 | 15 |
ToolApplicationModel subclass:#ImageEditor |
975 | 16 |
instanceVariableNames:'imageEditView colorMapMode editMode mouseKeyColorMode |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
17 |
selectedColorIndex postOpenAction imageSeqNr' |
1353 | 18 |
classVariableNames:'LastDirectory' |
929 | 19 |
poolDictionaries:'' |
20 |
category:'Interface-UIPainter' |
|
400 | 21 |
! |
22 |
||
23 |
!ImageEditor class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
767 | 27 |
COPYRIGHT (c) 1997-1998 by eXept Software AG |
400 | 28 |
All Rights Reserved |
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
405 | 32 |
inclusion of the above copyright notice. This software may not |
400 | 33 |
be provided or otherwise made available to, or used by, any |
405 | 34 |
other person. No title to or ownership of the software is |
400 | 35 |
hereby transferred. |
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
737 | 41 |
Image Editor allows you to create, design, modify or just inspect images. |
400 | 42 |
|
43 |
[start with:] |
|
44 |
ImageEditor open |
|
941 | 45 |
ImageEditor openOnClass:Icon andSelector:#startIcon |
400 | 46 |
|
47 |
[see also:] |
|
48 |
ImageEditView Image |
|
49 |
||
50 |
[author:] |
|
544 | 51 |
Thomas Zwick, eXept Software AG |
400 | 52 |
" |
53 |
! ! |
|
54 |
||
55 |
!ImageEditor class methodsFor:'instance creation'! |
|
56 |
||
57 |
openModalOnClass: aClass andSelector: aSelector |
|
900 | 58 |
"opens modal a Image Editor on aClass and aSelector" |
767 | 59 |
" |
60 |
self openModalOnClass: self andSelector: #leftMouseKeyIcon |
|
61 |
" |
|
400 | 62 |
|
767 | 63 |
|imageEditor imageEditView className resourceClassName resourceSelector| |
64 |
||
400 | 65 |
imageEditor := self new. |
767 | 66 |
|
900 | 67 |
aClass isClass ifTrue: [className := aClass name]. |
68 |
aClass isString ifTrue: [className := aClass]. |
|
903 | 69 |
aClass isNil ifTrue: [className := '']. |
400 | 70 |
|
688 | 71 |
imageEditor postOpenAction: [imageEditView := imageEditor imageEditView. imageEditor loadFromOrPrepareForMessage: className, ' ', aSelector]. |
400 | 72 |
imageEditor openModal. |
73 |
||
688 | 74 |
resourceClassName := imageEditView resourceClass. |
767 | 75 |
resourceSelector := imageEditView resourceSelector. |
415 | 76 |
|
815 | 77 |
((className asString ~= resourceClassName) |
78 |
or:[aSelector asString ~= resourceSelector]) |
|
415 | 79 |
ifTrue: [^resourceClassName, ' ', resourceSelector] |
80 |
ifFalse:[^nil] |
|
400 | 81 |
! |
82 |
||
83 |
openOnClass: aClass andSelector: aSelector |
|
900 | 84 |
"opens a Image Editor on aClass and aSelector" |
767 | 85 |
" |
86 |
self openOnClass: self andSelector: #leftMouseKeyIcon |
|
87 |
" |
|
400 | 88 |
|
1057 | 89 |
|editor| |
90 |
||
91 |
editor := self new. |
|
92 |
editor allButOpen. |
|
1381 | 93 |
aSelector notNil ifTrue:[ |
94 |
editor loadFromMessage: aClass name, ' ', aSelector. |
|
95 |
] ifFalse:[ |
|
96 |
editor resourceClass:aClass |
|
97 |
]. |
|
1057 | 98 |
editor openWindow |
99 |
||
100 |
"Modified: / 16.3.1999 / 21:33:49 / cg" |
|
400 | 101 |
! |
102 |
||
767 | 103 |
openOnFile: aFileName |
900 | 104 |
"opens a Image Editor on aFileName" |
767 | 105 |
" |
106 |
self openOnFile: 'bitmaps/SmalltalkX.xbm' |
|
107 |
" |
|
400 | 108 |
|
1057 | 109 |
|editor| |
110 |
||
111 |
editor := self new. |
|
112 |
editor allButOpen. |
|
113 |
editor loadFromFile: aFileName. |
|
114 |
editor openWindow |
|
115 |
||
116 |
"Modified: / 16.3.1999 / 21:33:25 / cg" |
|
400 | 117 |
! |
118 |
||
767 | 119 |
openOnImage: anImage |
900 | 120 |
"opens a Image Editor on anImage" |
767 | 121 |
" |
895 | 122 |
self openOnImage: Icon startIcon |
767 | 123 |
" |
400 | 124 |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
125 |
|editor| |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
126 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
127 |
editor := self new. |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
128 |
editor allButOpen. |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
129 |
editor loadFromImage: anImage. |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
130 |
editor openWindow |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
131 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
132 |
"Modified: / 11.3.1999 / 16:18:33 / cg" |
400 | 133 |
! ! |
134 |
||
135 |
!ImageEditor class methodsFor:'accessing'! |
|
136 |
||
137 |
listOfColorMaps |
|
767 | 138 |
"returns the list of default color maps for a new image" |
400 | 139 |
|
140 |
|colorMap| |
|
898 | 141 |
|
400 | 142 |
(colorMap := OrderedCollection new) |
143 |
add: Color black; |
|
144 |
add: Color white; |
|
145 |
add: Color red; |
|
146 |
add: Color green; |
|
147 |
add: Color blue; |
|
148 |
add: Color cyan; |
|
149 |
add: Color yellow; |
|
150 |
add: Color magenta; |
|
898 | 151 |
add: (Color redByte: 127 greenByte: 0 blueByte: 0); |
152 |
add: (Color redByte: 0 greenByte: 127 blueByte: 0); |
|
153 |
add: (Color redByte: 0 greenByte: 0 blueByte: 127); |
|
154 |
add: (Color redByte: 0 greenByte: 127 blueByte: 127); |
|
155 |
add: (Color redByte: 127 greenByte: 127 blueByte: 0); |
|
156 |
add: (Color redByte: 127 greenByte: 0 blueByte: 127); |
|
157 |
add: (Color redByte: 127 greenByte: 127 blueByte: 127); |
|
158 |
add: (Color redByte: 170 greenByte: 170 blueByte: 170). |
|
159 |
||
400 | 160 |
0 to: 5 do: |
161 |
[:r| |
|
162 |
0 to: 5 do: |
|
163 |
[:g| |
|
164 |
0 to: 5 do: |
|
165 |
[:b| |
|
898 | 166 |
colorMap add: (Color redByte: (r*255//5) ceiling greenByte: (g*255//5) ceiling blueByte: (b*255//5) ceiling) |
400 | 167 |
] |
168 |
] |
|
169 |
]. |
|
170 |
||
171 |
1 to: 25 do: |
|
172 |
[:g| |
|
898 | 173 |
colorMap add: (Color redByte: (g*255//26) ceiling greenByte: (g*255//26) ceiling blueByte: (g*255//26) ceiling) |
400 | 174 |
]. |
175 |
||
176 |
^Dictionary new |
|
177 |
at: '8-plane' put: colorMap; |
|
178 |
at: '8-plane + mask' put: colorMap; |
|
179 |
at: '4-plane' put: (colorMap copyFrom: 1 to: 16); |
|
180 |
at: '4-plane + mask' put: (colorMap copyFrom: 1 to: 16); |
|
181 |
at: '2-plane' put: (colorMap copyFrom: 1 to: 4); |
|
182 |
at: '2-plane + mask' put: (colorMap copyFrom: 1 to: 4); |
|
183 |
at: '1-plane' put: (colorMap copyFrom: 1 to: 2); |
|
184 |
at: '1-plane + mask' put: (colorMap copyFrom: 1 to: 2); |
|
185 |
yourself |
|
186 |
! |
|
187 |
||
188 |
listOfDefaultSizes |
|
767 | 189 |
"returns the list of default sizes for a new image" |
400 | 190 |
|
932
7111238cda23
fixed dimension of new-image dialog.
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
191 |
^#('8x8' '16x16' '22x22' '32x32' '48x48' '64x64') |
7111238cda23
fixed dimension of new-image dialog.
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
192 |
|
7111238cda23
fixed dimension of new-image dialog.
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
193 |
"Modified: / 31.7.1998 / 01:57:34 / cg" |
400 | 194 |
! ! |
195 |
||
460 | 196 |
!ImageEditor class methodsFor:'help specs'! |
197 |
||
198 |
helpSpec |
|
737 | 199 |
"This resource specification was automatically generated |
200 |
by the UIHelpTool of ST/X." |
|
201 |
||
202 |
"Do not manually edit this!! If it is corrupted, |
|
203 |
the UIHelpTool may not be able to read the specification." |
|
460 | 204 |
|
205 |
" |
|
737 | 206 |
UIHelpTool openOnClass:ImageEditor |
460 | 207 |
" |
208 |
||
737 | 209 |
<resource: #help> |
210 |
||
211 |
^super helpSpec addPairsFrom:#( |
|
460 | 212 |
|
213 |
#colorMap |
|
929 | 214 |
'ColorMap functions.' |
215 |
||
216 |
#colorMap1 |
|
217 |
'Convert to depth-1 image.' |
|
218 |
||
986 | 219 |
#colorMap1M |
220 |
'Convert to depth-1 image plus mask.' |
|
221 |
||
929 | 222 |
#colorMap2 |
223 |
'Convert to depth-2 image.' |
|
224 |
||
986 | 225 |
#colorMap2M |
226 |
'Convert to depth-2 image plus mask.' |
|
227 |
||
929 | 228 |
#colorMap4 |
229 |
'Convert to depth-4 image.' |
|
230 |
||
986 | 231 |
#colorMap4M |
232 |
'Convert to depth-4 image plus mask.' |
|
233 |
||
929 | 234 |
#colorMap8 |
235 |
'Convert to depth-8 image.' |
|
236 |
||
237 |
#colorMap8M |
|
238 |
'Convert to depth-8 image plus mask.' |
|
239 |
||
986 | 240 |
#colorMapTable |
241 |
'Shows a list of used colors of the image.' |
|
242 |
||
929 | 243 |
#compressColormap |
244 |
'Remove unneeded entries from the colorMap.' |
|
460 | 245 |
|
1045 | 246 |
#cropAll |
986 | 247 |
'Find and remove all borders.' |
248 |
||
1045 | 249 |
#cropBottom |
986 | 250 |
'Find and remove bottom border.' |
251 |
||
1045 | 252 |
#cropLeft |
986 | 253 |
'Find and remove left border.' |
254 |
||
1045 | 255 |
#cropManual |
986 | 256 |
'Specify border(s) to remove.' |
257 |
||
1045 | 258 |
#cropRight |
986 | 259 |
'Find and remove right border.' |
260 |
||
1045 | 261 |
#cropTop |
986 | 262 |
'Find and remove top border.' |
487 | 263 |
|
460 | 264 |
#drawModeBox |
914 | 265 |
'Switches to box-drawing mode.' |
460 | 266 |
|
267 |
#drawModeCopy |
|
914 | 268 |
'Switches to area-copy mode.' |
460 | 269 |
|
270 |
#drawModeFill |
|
914 | 271 |
'Switches to flood-fill mode.' |
460 | 272 |
|
273 |
#drawModeFilledBox |
|
914 | 274 |
'Switches to filled-box drawing mode.' |
460 | 275 |
|
276 |
#drawModePaste |
|
914 | 277 |
'Switches to paste mode.' |
278 |
||
279 |
#drawModePasteUnder |
|
280 |
'Switches to paste under mode.' |
|
460 | 281 |
|
282 |
#drawModePoint |
|
914 | 283 |
'Switches to point-drawing mode.' |
460 | 284 |
|
285 |
#editFlipHorizontal |
|
914 | 286 |
'Flips the image horizontally.' |
460 | 287 |
|
288 |
#editFlipVertical |
|
914 | 289 |
'Flips the image vertically.' |
460 | 290 |
|
291 |
#editMagnifyImage |
|
914 | 292 |
'Magnify the image.' |
460 | 293 |
|
294 |
#editNegate |
|
914 | 295 |
'Invert the images colors.' |
460 | 296 |
|
297 |
#editResize |
|
914 | 298 |
'Resize the image (preserving the old image).' |
460 | 299 |
|
300 |
#editRotate |
|
914 | 301 |
'Rotate the image.' |
460 | 302 |
|
929 | 303 |
#fileGrabImage |
304 |
'Pick an image from the screen.' |
|
305 |
||
460 | 306 |
#fileLoadFromClass |
929 | 307 |
'Select and load an image from a resource method.' |
460 | 308 |
|
309 |
#fileLoadFromFile |
|
929 | 310 |
'Select and load an image from a file.' |
460 | 311 |
|
312 |
#fileNewImage |
|
914 | 313 |
'Create a new image' |
460 | 314 |
|
315 |
#filePrint |
|
316 |
'Print the image on a postscript printer.' |
|
317 |
||
318 |
#fileSaveAs |
|
914 | 319 |
'Save the image to a file.' |
460 | 320 |
|
321 |
#fileSaveMaskAs |
|
914 | 322 |
'Save the mask of the image to a file.' |
460 | 323 |
|
324 |
#fileSaveMethod |
|
914 | 325 |
'Save the image as resource method in the current class and selector.' |
460 | 326 |
|
327 |
#fileSaveMethodAs |
|
914 | 328 |
'Save the image as resource method in a class.' |
460 | 329 |
|
487 | 330 |
#magnificationNumber |
914 | 331 |
'Shows the current magnification.' |
487 | 332 |
|
333 |
#magnifyImageDown |
|
914 | 334 |
'Decrease magnification.' |
487 | 335 |
|
336 |
#magnifyImageUp |
|
914 | 337 |
'Increase magnification.' |
487 | 338 |
|
339 |
#mouseKeyColorMode |
|
914 | 340 |
'Toggles between left and right mouse button color.' |
487 | 341 |
|
342 |
#previewView |
|
914 | 343 |
'Shows a preview of the image.' |
487 | 344 |
|
905 | 345 |
#settingsGridMagnification |
914 | 346 |
'Change the grid magnification of the edit view.' |
905 | 347 |
|
460 | 348 |
) |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
349 |
|
986 | 350 |
"Modified: / 7.9.1998 / 18:20:26 / cg" |
460 | 351 |
! ! |
352 |
||
737 | 353 |
!ImageEditor class methodsFor:'image specs'! |
354 |
||
355 |
leftMouseKeyIcon |
|
356 |
"This resource specification was automatically generated |
|
357 |
by the ImageEditor of ST/X." |
|
358 |
||
359 |
"Do not manually edit this!! If it is corrupted, |
|
360 |
the ImageEditor may not be able to read the specification." |
|
361 |
||
362 |
" |
|
1405 | 363 |
self leftMouseKeyIcon inspect |
737 | 364 |
ImageEditor openOnClass:self andSelector:#leftMouseKeyIcon |
365 |
" |
|
366 |
||
367 |
<resource: #image> |
|
368 |
||
369 |
^Icon |
|
370 |
constantNamed:#'ImageEditor leftMouseKeyIcon' |
|
1405 | 371 |
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@EJJ@@AR" @@T((@@@@@@@B** @@**(@@J**@@B** @@**(@@J**@@@**@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@?0G? _>A?8G? _>A?8G? _>A?8G? O<@_ @@@b') ; yourself); yourself]! |
737 | 372 |
|
373 |
rightMouseKeyIcon |
|
374 |
"This resource specification was automatically generated |
|
375 |
by the ImageEditor of ST/X." |
|
376 |
||
377 |
"Do not manually edit this!! If it is corrupted, |
|
378 |
the ImageEditor may not be able to read the specification." |
|
379 |
||
380 |
" |
|
1405 | 381 |
self rightMouseKeyIcon inspect |
737 | 382 |
ImageEditor openOnClass:self andSelector:#rightMouseKeyIcon |
383 |
" |
|
384 |
||
385 |
<resource: #image> |
|
386 |
||
387 |
^Icon |
|
388 |
constantNamed:#'ImageEditor rightMouseKeyIcon' |
|
1405 | 389 |
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@JJE@@B"!!P@@((T@@@@@@@B** @@**(@@J**@@B** @@**(@@J**@@@**@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@?0G? _>A?8G? _>A?8G? _>A?8G? O<@_ @@@b') ; yourself); yourself]! ! |
737 | 390 |
|
400 | 391 |
!ImageEditor class methodsFor:'interface specs'! |
392 |
||
767 | 393 |
dialogSpecForNewImage |
737 | 394 |
"This resource specification was automatically generated |
395 |
by the UIPainter of ST/X." |
|
519 | 396 |
|
737 | 397 |
"Do not manually edit this!! If it is corrupted, |
398 |
the UIPainter may not be able to read the specification." |
|
519 | 399 |
|
400 |
" |
|
767 | 401 |
UIPainter new openOnClass:ImageEditor andSelector:#dialogSpecForNewImage |
402 |
ImageEditor new openInterface:#dialogSpecForNewImage |
|
519 | 403 |
" |
404 |
||
405 |
<resource: #canvas> |
|
406 |
||
407 |
^ |
|
408 |
||
409 |
#(#FullSpec |
|
672 | 410 |
#window: |
519 | 411 |
#(#WindowSpec |
672 | 412 |
#name: 'New Image' |
975 | 413 |
#layout: #(#LayoutFrame 81 0 288 0 381 0 406 0) |
672 | 414 |
#label: 'New Image' |
415 |
#min: #(#Point 10 10) |
|
416 |
#max: #(#Point 1152 900) |
|
975 | 417 |
#bounds: #(#Rectangle 81 288 382 407) |
672 | 418 |
#usePreferredExtent: false |
519 | 419 |
) |
672 | 420 |
#component: |
519 | 421 |
#(#SpecCollection |
672 | 422 |
#collection: |
519 | 423 |
#( |
424 |
#(#ViewSpec |
|
672 | 425 |
#name: 'View' |
737 | 426 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -35 1.0) |
672 | 427 |
#component: |
519 | 428 |
#(#SpecCollection |
672 | 429 |
#collection: |
519 | 430 |
#( |
431 |
#(#FramedBoxSpec |
|
672 | 432 |
#name: 'framedBox1' |
932
7111238cda23
fixed dimension of new-image dialog.
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
433 |
#layout: #(#LayoutFrame 1 0.0 7 0.0 0 0.4 76 0) |
672 | 434 |
#component: |
519 | 435 |
#(#SpecCollection |
672 | 436 |
#collection: |
519 | 437 |
#( |
438 |
#(#ComboBoxSpec |
|
672 | 439 |
#name: 'defaultSizesComboBox' |
975 | 440 |
#layout: #(#LayoutFrame 0 0.0 10 0.0 0 1 35 0.0) |
672 | 441 |
#model: #selectionOfSize |
442 |
#type: #string |
|
443 |
#comboList: #listOfDefaultSizes |
|
519 | 444 |
) |
445 |
) |
|
446 |
) |
|
672 | 447 |
#label: 'Size' |
448 |
#labelPosition: #topLeft |
|
449 |
#style: #(#FontDescription #helvetica #medium #roman 12) |
|
519 | 450 |
) |
451 |
#(#FramedBoxSpec |
|
672 | 452 |
#name: 'framedBox2' |
932
7111238cda23
fixed dimension of new-image dialog.
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
453 |
#layout: #(#LayoutFrame 0 0.4 7 0.0 -1 1.0 76 0) |
672 | 454 |
#component: |
519 | 455 |
#(#SpecCollection |
672 | 456 |
#collection: |
519 | 457 |
#( |
458 |
#(#ComboListSpec |
|
672 | 459 |
#name: 'colorMapComboBox' |
975 | 460 |
#layout: #(#LayoutFrame 0 0.0 10 0.0 0 1 35 0.0) |
672 | 461 |
#model: #selectionOfColorMap |
462 |
#comboList: #listOfColorMaps |
|
463 |
#useIndex: false |
|
519 | 464 |
) |
465 |
) |
|
466 |
) |
|
672 | 467 |
#label: 'Color Map' |
468 |
#labelPosition: #topLeft |
|
469 |
#style: #(#FontDescription #helvetica #medium #roman 12) |
|
519 | 470 |
) |
471 |
) |
|
472 |
) |
|
672 | 473 |
#level: 1 |
519 | 474 |
) |
672 | 475 |
#(#UISubSpecification |
975 | 476 |
#name: 'windowSpecForCommitWithoutChannels' |
737 | 477 |
#layout: #(#LayoutFrame 2 0.0 -26 1 -2 1.0 -2 1.0) |
672 | 478 |
#minorKey: #windowSpecForCommitWithoutChannels |
519 | 479 |
) |
480 |
) |
|
481 |
) |
|
482 |
) |
|
767 | 483 |
! |
484 |
||
1045 | 485 |
gropDialogSpec |
986 | 486 |
"This resource specification was automatically generated |
487 |
by the UIPainter of ST/X." |
|
488 |
||
489 |
"Do not manually edit this!! If it is corrupted, |
|
490 |
the UIPainter may not be able to read the specification." |
|
491 |
||
492 |
" |
|
493 |
UIPainter new openOnClass:ImageEditor andSelector:#grobDialogSpec |
|
494 |
ImageEditor new openInterface:#grobDialogSpec |
|
495 |
" |
|
496 |
||
497 |
<resource: #canvas> |
|
498 |
||
499 |
^ |
|
500 |
||
501 |
#(#FullSpec |
|
502 |
#window: |
|
503 |
#(#WindowSpec |
|
1045 | 504 |
#name: 'Crop Borders' |
986 | 505 |
#layout: #(#LayoutFrame 22 0 233 0 266 0 415 0) |
1045 | 506 |
#label: 'Crop Borders' |
986 | 507 |
#min: #(#Point 10 10) |
508 |
#max: #(#Point 800 478) |
|
509 |
#bounds: #(#Rectangle 22 233 267 416) |
|
510 |
#usePreferredExtent: false |
|
511 |
) |
|
512 |
#component: |
|
513 |
#(#SpecCollection |
|
514 |
#collection: |
|
515 |
#( |
|
516 |
#(#LabelSpec |
|
517 |
#name: 'Label1' |
|
518 |
#layout: #(#LayoutFrame 14 0 21 0 90 0 43 0) |
|
519 |
#label: 'Left:' |
|
520 |
#translateLabel: true |
|
521 |
#adjust: #right |
|
522 |
) |
|
523 |
#(#InputFieldSpec |
|
524 |
#name: 'EntryField1' |
|
525 |
#layout: #(#LayoutFrame 95 0 21 0 132 0 43 0) |
|
526 |
#model: #left |
|
527 |
#type: #number |
|
528 |
) |
|
529 |
#(#LabelSpec |
|
530 |
#name: 'Label2' |
|
531 |
#layout: #(#LayoutFrame 14 0 51 0 90 0 73 0) |
|
532 |
#label: 'Right:' |
|
533 |
#translateLabel: true |
|
534 |
#adjust: #right |
|
535 |
) |
|
536 |
#(#InputFieldSpec |
|
537 |
#name: 'EntryField2' |
|
538 |
#layout: #(#LayoutFrame 95 0 51 0 132 0 73 0) |
|
539 |
#model: #right |
|
540 |
#type: #number |
|
541 |
) |
|
542 |
#(#LabelSpec |
|
543 |
#name: 'Label3' |
|
544 |
#layout: #(#LayoutFrame 14 0 81 0 90 0 103 0) |
|
545 |
#label: 'Top:' |
|
546 |
#translateLabel: true |
|
547 |
#adjust: #right |
|
548 |
) |
|
549 |
#(#InputFieldSpec |
|
550 |
#name: 'EntryField3' |
|
551 |
#layout: #(#LayoutFrame 95 0 81 0 132 0 103 0) |
|
552 |
#model: #top |
|
553 |
#type: #number |
|
554 |
) |
|
555 |
#(#LabelSpec |
|
556 |
#name: 'Label4' |
|
557 |
#layout: #(#LayoutFrame 14 0 111 0 90 0 133 0) |
|
558 |
#label: 'Bottom:' |
|
559 |
#translateLabel: true |
|
560 |
#adjust: #right |
|
561 |
) |
|
562 |
#(#InputFieldSpec |
|
563 |
#name: 'EntryField4' |
|
564 |
#layout: #(#LayoutFrame 95 0 111 0 132 0 133 0) |
|
565 |
#model: #bottom |
|
566 |
#type: #number |
|
567 |
) |
|
568 |
#(#HorizontalPanelViewSpec |
|
569 |
#name: 'HorizontalPanel1' |
|
570 |
#layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1) |
|
571 |
#component: |
|
572 |
#(#SpecCollection |
|
573 |
#collection: |
|
574 |
#( |
|
575 |
#(#ActionButtonSpec |
|
576 |
#name: 'Button1' |
|
577 |
#label: 'Cancel' |
|
578 |
#translateLabel: true |
|
579 |
#model: #cancel |
|
580 |
#extent: #(#Point 118 22) |
|
581 |
) |
|
582 |
#(#ActionButtonSpec |
|
583 |
#name: 'Button2' |
|
584 |
#label: 'OK' |
|
585 |
#translateLabel: true |
|
586 |
#model: #accept |
|
587 |
#extent: #(#Point 118 22) |
|
588 |
) |
|
589 |
) |
|
590 |
) |
|
591 |
#horizontalLayout: #fitSpace |
|
592 |
#verticalLayout: #center |
|
593 |
#horizontalSpace: 3 |
|
594 |
#verticalSpace: 3 |
|
595 |
) |
|
596 |
) |
|
597 |
) |
|
598 |
) |
|
599 |
||
600 |
"Modified: / 7.9.1998 / 18:29:34 / cg" |
|
601 |
! |
|
602 |
||
767 | 603 |
windowSpec |
604 |
"This resource specification was automatically generated |
|
605 |
by the UIPainter of ST/X." |
|
606 |
||
607 |
"Do not manually edit this!! If it is corrupted, |
|
608 |
the UIPainter may not be able to read the specification." |
|
609 |
||
610 |
" |
|
611 |
UIPainter new openOnClass:ImageEditor andSelector:#windowSpec |
|
612 |
ImageEditor new openInterface:#windowSpec |
|
613 |
ImageEditor open |
|
614 |
" |
|
615 |
||
616 |
<resource: #canvas> |
|
617 |
||
618 |
^ |
|
619 |
||
620 |
#(#FullSpec |
|
621 |
#window: |
|
622 |
#(#WindowSpec |
|
623 |
#name: 'Image Editor' |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
624 |
#layout: #(#LayoutFrame 507 0 28 0 1004 0 371 0) |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
625 |
#level: 0 |
767 | 626 |
#label: 'Image Editor' |
627 |
#min: #(#Point 400 320) |
|
628 |
#max: #(#Point 1152 900) |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
629 |
#bounds: #(#Rectangle 507 28 1005 372) |
767 | 630 |
#menu: #menu |
631 |
#usePreferredExtent: false |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
632 |
#returnIsOKInDialog: true |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
633 |
#escapeIsCancelInDialog: true |
767 | 634 |
) |
635 |
#component: |
|
636 |
#(#SpecCollection |
|
637 |
#collection: |
|
638 |
#( |
|
639 |
#(#MenuPanelSpec |
|
640 |
#name: 'menuToolbarView' |
|
641 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
642 |
#menu: #menuToolbar |
|
643 |
#style: #(#FontDescription #helvetica #medium #roman 10) |
|
644 |
#showSeparatingLines: true |
|
645 |
) |
|
646 |
#(#VariableHorizontalPanelSpec |
|
647 |
#name: 'variableHorizontalPanel1' |
|
648 |
#layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0) |
|
649 |
#component: |
|
650 |
#(#SpecCollection |
|
651 |
#collection: |
|
652 |
#( |
|
653 |
#(#ViewSpec |
|
654 |
#name: 'view1' |
|
655 |
#component: |
|
656 |
#(#SpecCollection |
|
657 |
#collection: |
|
658 |
#( |
|
659 |
#(#VariableVerticalPanelSpec |
|
660 |
#name: 'VariableVerticalPanel1' |
|
661 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
662 |
#component: |
|
663 |
#(#SpecCollection |
|
664 |
#collection: |
|
665 |
#( |
|
666 |
#(#ViewSpec |
|
667 |
#name: 'View1' |
|
668 |
#component: |
|
669 |
#(#SpecCollection |
|
670 |
#collection: |
|
671 |
#( |
|
672 |
#(#MenuPanelSpec |
|
673 |
#name: 'MouseButtonColorToolBar' |
|
674 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 24 0) |
|
675 |
#menu: #menuMouseButtonColors |
|
676 |
) |
|
677 |
#(#DataSetSpec |
|
678 |
#name: 'colorDataSetView' |
|
679 |
#layout: #(#LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0) |
|
680 |
#activeHelpKey: #colorMapTable |
|
681 |
#model: #selectionOfColor |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
682 |
#menu: #colorMapMenu |
767 | 683 |
#style: #(#FontDescription #helvetica #medium #roman 10) |
684 |
#hasHorizontalScrollBar: true |
|
685 |
#hasVerticalScrollBar: true |
|
686 |
#miniScrollerHorizontal: true |
|
687 |
#miniScrollerVertical: true |
|
688 |
#dataList: #listOfColors |
|
689 |
#has3Dsepartors: true |
|
905 | 690 |
#has3Dseparators: true |
767 | 691 |
#verticalSpacing: 1 |
692 |
#columns: |
|
693 |
#( |
|
694 |
#(#DataSetColumnSpec |
|
695 |
#rendererType: #rowSelector |
|
696 |
#backgroundSelector: #yourself |
|
697 |
) |
|
698 |
#(#DataSetColumnSpec |
|
699 |
#label: 'R' |
|
700 |
#labelAlignment: #left |
|
942 | 701 |
#columnAlignment: #right |
702 |
#editorType: #InputField |
|
703 |
#type: #number |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
704 |
#model: #redFromColor: |
942 | 705 |
#writeSelector: #redAtColor:put: |
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
706 |
#selectSelector: #canSelectRedInColor: |
767 | 707 |
) |
708 |
#(#DataSetColumnSpec |
|
709 |
#label: 'G' |
|
710 |
#labelAlignment: #left |
|
942 | 711 |
#columnAlignment: #right |
712 |
#editorType: #InputField |
|
713 |
#type: #number |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
714 |
#model: #greenFromColor: |
942 | 715 |
#writeSelector: #greenAtColor:put: |
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
716 |
#selectSelector: #canSelectGreenInColor: |
767 | 717 |
) |
718 |
#(#DataSetColumnSpec |
|
719 |
#label: 'B' |
|
720 |
#labelAlignment: #left |
|
942 | 721 |
#columnAlignment: #right |
722 |
#editorType: #InputField |
|
723 |
#type: #number |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
724 |
#model: #blueFromColor: |
942 | 725 |
#writeSelector: #blueAtColor:put: |
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
726 |
#selectSelector: #canSelectBlueInColor: |
767 | 727 |
) |
728 |
) |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
729 |
#columnAdaptor: #colorColumnAdaptor |
767 | 730 |
) |
731 |
) |
|
732 |
) |
|
733 |
) |
|
734 |
#(#ArbitraryComponentSpec |
|
735 |
#name: 'imagePreView' |
|
736 |
#activeHelpKey: #previewView |
|
737 |
#hasHorizontalScrollBar: true |
|
738 |
#hasVerticalScrollBar: true |
|
739 |
#miniScrollerHorizontal: true |
|
740 |
#miniScrollerVertical: true |
|
741 |
#component: #ImageView |
|
742 |
#hasBorder: false |
|
743 |
) |
|
744 |
) |
|
745 |
) |
|
746 |
#handles: #(#Any 0.723776 1.0) |
|
747 |
) |
|
748 |
) |
|
749 |
) |
|
750 |
) |
|
751 |
#(#ViewSpec |
|
752 |
#name: 'view2' |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
753 |
#level: -1 |
767 | 754 |
#component: |
755 |
#(#SpecCollection |
|
756 |
#collection: |
|
757 |
#( |
|
758 |
#(#ArbitraryComponentSpec |
|
759 |
#name: 'imageEditView' |
|
760 |
#layout: #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0) |
|
761 |
#hasHorizontalScrollBar: true |
|
762 |
#hasVerticalScrollBar: true |
|
763 |
#component: #ImageEditView |
|
764 |
#hasBorder: false |
|
765 |
) |
|
766 |
#(#LabelSpec |
|
767 |
#name: 'coordLabel' |
|
768 |
#layout: #(#LayoutFrame 2 0.0 -22 1 -83 1.0 0 1.0) |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
769 |
#level: -1 |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
770 |
#labelChannel: #imageInfoHolder |
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
771 |
#resizeForLabel: false |
767 | 772 |
#adjust: #left |
773 |
) |
|
774 |
#(#ArrowButtonSpec |
|
775 |
#name: 'magnifyDownButton' |
|
776 |
#layout: #(#LayoutFrame -80 1 -22 1 -58 1 0 1) |
|
777 |
#activeHelpKey: #magnifyImageDown |
|
778 |
#model: #doMagnifyDown |
|
779 |
#enableChannel: #imageIsLoaded |
|
780 |
#isTriggerOnDown: true |
|
781 |
#direction: #left |
|
782 |
) |
|
783 |
#(#ArrowButtonSpec |
|
784 |
#name: 'magnifyUpButton' |
|
785 |
#layout: #(#LayoutFrame -24 1 -22 1 -2 1 0 1) |
|
786 |
#activeHelpKey: #magnifyImageUp |
|
787 |
#model: #doMagnifyUp |
|
788 |
#enableChannel: #imageIsLoaded |
|
789 |
#isTriggerOnDown: true |
|
790 |
#direction: #right |
|
791 |
) |
|
792 |
#(#InputFieldSpec |
|
793 |
#name: 'magnificationInputField' |
|
794 |
#layout: #(#LayoutFrame -57 1 -22 1 -26 1 0 1) |
|
795 |
#activeHelpKey: #magnificationNumber |
|
796 |
#enableChannel: #imageIsLoaded |
|
797 |
#model: #valueOfMagnification |
|
905 | 798 |
#type: #numberInRange |
767 | 799 |
#acceptOnReturn: false |
800 |
#acceptOnTab: false |
|
801 |
#numChars: 2 |
|
905 | 802 |
#minValue: 1 |
803 |
#maxValue: 99 |
|
767 | 804 |
) |
805 |
) |
|
806 |
) |
|
807 |
) |
|
808 |
) |
|
809 |
) |
|
810 |
#handles: #(#Any 0.276 1.0) |
|
811 |
) |
|
812 |
#(#UISubSpecification |
|
813 |
#name: 'infoBarSubSpec' |
|
814 |
#layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) |
|
815 |
#majorKey: #ToolApplicationModel |
|
816 |
#minorKey: #windowSpecForInfoBar |
|
817 |
) |
|
818 |
) |
|
819 |
) |
|
820 |
) |
|
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
821 |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
822 |
"Modified: / 12.3.1999 / 00:15:05 / cg" |
519 | 823 |
! ! |
824 |
||
825 |
!ImageEditor class methodsFor:'menu specs'! |
|
826 |
||
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
827 |
colorMapMenu |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
828 |
"This resource specification was automatically generated |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
829 |
by the MenuEditor of ST/X." |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
830 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
831 |
"Do not manually edit this!! If it is corrupted, |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
832 |
the MenuEditor may not be able to read the specification." |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
833 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
834 |
" |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
835 |
MenuEditor new openOnClass:ImageEditor andSelector:#menuSpec |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
836 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menuSpec)) startUp |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
837 |
" |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
838 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
839 |
<resource: #menu> |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
840 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
841 |
^ |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
842 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
843 |
#(#Menu |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
844 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
845 |
#( |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
846 |
#(#MenuItem |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
847 |
#label: 'Add Color' |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
848 |
#translateLabel: true |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
849 |
#value: #addColorToColormap |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
850 |
) |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
851 |
) nil |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
852 |
nil |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
853 |
) |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
854 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
855 |
"Created: / 12.3.1999 / 00:19:00 / cg" |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
856 |
! |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
857 |
|
400 | 858 |
menu |
737 | 859 |
"This resource specification was automatically generated |
860 |
by the MenuEditor of ST/X." |
|
400 | 861 |
|
737 | 862 |
"Do not manually edit this!! If it is corrupted, |
863 |
the MenuEditor may not be able to read the specification." |
|
400 | 864 |
|
865 |
" |
|
866 |
MenuEditor new openOnClass:ImageEditor andSelector:#menu |
|
867 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menu)) startUp |
|
868 |
" |
|
869 |
||
870 |
<resource: #menu> |
|
871 |
||
1124 | 872 |
^ |
873 |
#(#Menu |
|
874 |
#( |
|
875 |
#(#MenuItem |
|
876 |
#label: 'About' |
|
877 |
#translateLabel: true |
|
878 |
#activeHelpKey: #about |
|
879 |
#labelImage: #(#ResourceRetriever nil #menuIcon) |
|
880 |
#submenuChannel: #menuAbout |
|
881 |
) |
|
882 |
#(#MenuItem |
|
883 |
#label: 'File' |
|
884 |
#translateLabel: true |
|
885 |
#activeHelpKey: #file |
|
886 |
#submenu: |
|
887 |
#(#Menu |
|
888 |
#( |
|
889 |
#(#MenuItem |
|
890 |
#label: 'New...' |
|
891 |
#translateLabel: true |
|
892 |
#value: #doNewImage |
|
893 |
#activeHelpKey: #fileNewImage |
|
894 |
) |
|
895 |
#(#MenuItem |
|
896 |
#label: '-' |
|
897 |
) |
|
898 |
#(#MenuItem |
|
899 |
#label: 'Load...' |
|
900 |
#translateLabel: true |
|
901 |
#value: #doLoadFromClass |
|
902 |
#activeHelpKey: #fileLoadFromClass |
|
903 |
) |
|
904 |
#(#MenuItem |
|
905 |
#label: 'Load From File...' |
|
906 |
#translateLabel: true |
|
907 |
#value: #doLoadFromFile |
|
908 |
#activeHelpKey: #fileLoadFromFile |
|
909 |
) |
|
910 |
#(#MenuItem |
|
911 |
#label: 'Grab From Screen' |
|
912 |
#translateLabel: true |
|
913 |
#value: #grabScreenImage |
|
914 |
#activeHelpKey: #fileGrabImage |
|
915 |
) |
|
916 |
#(#MenuItem |
|
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
917 |
#label: 'Next In Sequence' |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
918 |
#translateLabel: true |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
919 |
#value: #nextImageInSequence |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
920 |
#enabled: #imageHasNextImage |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
921 |
) |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
922 |
#(#MenuItem |
1124 | 923 |
#label: '-' |
924 |
) |
|
925 |
#(#MenuItem |
|
926 |
#label: 'Save' |
|
927 |
#translateLabel: true |
|
928 |
#value: #doSaveMethod |
|
929 |
#activeHelpKey: #fileSaveMethod |
|
930 |
#enabled: #imageIsLoadedAndClassDefined |
|
931 |
) |
|
932 |
#(#MenuItem |
|
933 |
#label: 'Save As...' |
|
934 |
#translateLabel: true |
|
935 |
#value: #doSaveMethodAs |
|
936 |
#activeHelpKey: #fileSaveMethodAs |
|
937 |
#enabled: #imageIsLoaded |
|
938 |
) |
|
939 |
#(#MenuItem |
|
940 |
#label: '-' |
|
941 |
) |
|
942 |
#(#MenuItem |
|
943 |
#label: 'Save To File...' |
|
944 |
#translateLabel: true |
|
945 |
#value: #doSaveImageFileAs |
|
946 |
#activeHelpKey: #fileSaveAs |
|
947 |
#enabled: #imageIsLoaded |
|
948 |
) |
|
949 |
#(#MenuItem |
|
950 |
#label: 'Save Mask To File...' |
|
951 |
#translateLabel: true |
|
952 |
#value: #doSaveImageMaskFileAs |
|
953 |
#activeHelpKey: #fileSaveMaskAs |
|
954 |
#enabled: #imageIsLoaded |
|
955 |
) |
|
956 |
#(#MenuItem |
|
957 |
#label: '-' |
|
958 |
) |
|
959 |
#(#MenuItem |
|
1309
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
960 |
#label: 'Show storeString' |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
961 |
#translateLabel: true |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
962 |
#value: #doShowStoreString |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
963 |
#activeHelpKey: #fileShowStoreString |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
964 |
#enabled: #imageIsLoaded |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
965 |
) |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
966 |
#(#MenuItem |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
967 |
#label: '-' |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
968 |
) |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
969 |
#(#MenuItem |
1124 | 970 |
#label: 'Print' |
971 |
#translateLabel: true |
|
972 |
#value: #doPrint |
|
973 |
#activeHelpKey: #filePrint |
|
974 |
#enabled: #imageIsLoaded |
|
975 |
) |
|
976 |
#(#MenuItem |
|
977 |
#label: '-' |
|
978 |
) |
|
979 |
#(#MenuItem |
|
980 |
#label: 'Browse Class' |
|
981 |
#translateLabel: true |
|
982 |
#value: #doBrowseClass |
|
983 |
#activeHelpKey: #fileBrowseClass |
|
984 |
#enabled: #hasClassDefined |
|
985 |
) |
|
986 |
#(#MenuItem |
|
987 |
#label: '-' |
|
988 |
) |
|
989 |
#(#MenuItem |
|
990 |
#label: 'Exit' |
|
991 |
#translateLabel: true |
|
992 |
#value: #closeRequest |
|
993 |
#activeHelpKey: #fileExit |
|
994 |
) |
|
995 |
) |
|
996 |
nil |
|
997 |
nil |
|
400 | 998 |
) |
1124 | 999 |
) |
1000 |
#(#MenuItem |
|
1001 |
#label: 'Edit' |
|
1002 |
#translateLabel: true |
|
1003 |
#activeHelpKey: #edit |
|
1004 |
#enabled: #imageIsLoaded |
|
1005 |
#submenu: |
|
1006 |
#(#Menu |
|
1007 |
#( |
|
1008 |
#(#MenuItem |
|
1009 |
#label: 'Undo' |
|
1010 |
#translateLabel: true |
|
1011 |
#value: #doUndo |
|
1012 |
#activeHelpKey: #editUndo |
|
1013 |
#enabled: #valueOfCanUndo |
|
1014 |
) |
|
1015 |
#(#MenuItem |
|
1016 |
#label: '-' |
|
1017 |
) |
|
1018 |
#(#MenuItem |
|
1019 |
#label: 'Flip - Vertical' |
|
1020 |
#translateLabel: true |
|
1021 |
#value: #doFlipVertical |
|
1022 |
#activeHelpKey: #editFlipVertical |
|
1023 |
) |
|
1024 |
#(#MenuItem |
|
1025 |
#label: 'Flip - Horizontal' |
|
1026 |
#translateLabel: true |
|
1027 |
#value: #doFlipHorizontal |
|
1028 |
#activeHelpKey: #editFlipHorizontal |
|
1029 |
) |
|
1030 |
#(#MenuItem |
|
1031 |
#label: '-' |
|
1032 |
) |
|
1033 |
#(#MenuItem |
|
1034 |
#label: 'Resize...' |
|
1035 |
#translateLabel: true |
|
1036 |
#value: #doResizeImage |
|
1037 |
#activeHelpKey: #editResize |
|
1038 |
) |
|
1039 |
#(#MenuItem |
|
1040 |
#label: 'Magnify...' |
|
1041 |
#translateLabel: true |
|
1042 |
#value: #doMagnifyImage |
|
1043 |
#activeHelpKey: #editMagnifyImage |
|
1044 |
) |
|
1045 |
#(#MenuItem |
|
1046 |
#label: 'Rotate...' |
|
1047 |
#translateLabel: true |
|
1048 |
#value: #doRotateImage |
|
1049 |
#activeHelpKey: #editRotate |
|
1050 |
) |
|
1051 |
#(#MenuItem |
|
1052 |
#label: '-' |
|
1053 |
) |
|
1054 |
#(#MenuItem |
|
1146 | 1055 |
#label: 'Invert' |
1056 |
#translateLabel: true |
|
1057 |
#value: #doNegativeImage |
|
1058 |
) |
|
1059 |
#(#MenuItem |
|
1060 |
#label: '-' |
|
1061 |
) |
|
1062 |
#(#MenuItem |
|
1124 | 1063 |
#label: 'Crop' |
1064 |
#translateLabel: true |
|
1065 |
#submenu: |
|
400 | 1066 |
#(#Menu |
1124 | 1067 |
#( |
1068 |
#(#MenuItem |
|
1069 |
#label: 'All' |
|
1070 |
#translateLabel: true |
|
1071 |
#value: #doCropAll |
|
1072 |
#activeHelpKey: #cropAll |
|
400 | 1073 |
) |
1124 | 1074 |
#(#MenuItem |
1075 |
#label: '-' |
|
986 | 1076 |
) |
1124 | 1077 |
#(#MenuItem |
1078 |
#label: 'Left' |
|
1079 |
#translateLabel: true |
|
1080 |
#value: #doCropLeft |
|
1081 |
#activeHelpKey: #cropLeft |
|
1082 |
) |
|
1083 |
#(#MenuItem |
|
1084 |
#label: 'Right' |
|
1085 |
#translateLabel: true |
|
1086 |
#value: #doCropRight |
|
1087 |
#activeHelpKey: #cropRight |
|
986 | 1088 |
) |
1124 | 1089 |
#(#MenuItem |
1090 |
#label: 'Top' |
|
1091 |
#translateLabel: true |
|
1092 |
#value: #doCropTop |
|
1093 |
#activeHelpKey: #cropTop |
|
672 | 1094 |
) |
1124 | 1095 |
#(#MenuItem |
1096 |
#label: 'Bottom' |
|
1097 |
#translateLabel: true |
|
1098 |
#value: #doCropBottom |
|
1099 |
#activeHelpKey: #cropBottom |
|
400 | 1100 |
) |
1124 | 1101 |
#(#MenuItem |
1102 |
#label: '-' |
|
400 | 1103 |
) |
1124 | 1104 |
#(#MenuItem |
1105 |
#label: 'Manual...' |
|
1106 |
#translateLabel: true |
|
1107 |
#value: #doCropManual |
|
1108 |
#activeHelpKey: #cropManual |
|
400 | 1109 |
) |
1124 | 1110 |
) |
1111 |
nil |
|
400 | 1112 |
nil |
1124 | 1113 |
) |
400 | 1114 |
) |
1124 | 1115 |
) |
1116 |
nil |
|
1117 |
nil |
|
400 | 1118 |
) |
1124 | 1119 |
) |
1120 |
#(#MenuItem |
|
1121 |
#label: 'ColorMap' |
|
1122 |
#translateLabel: true |
|
1123 |
#activeHelpKey: #colorMap |
|
1124 |
#enabled: #imageIsLoaded |
|
1125 |
#submenu: |
|
1126 |
#(#Menu |
|
1127 |
#( |
|
1128 |
#(#MenuItem |
|
1129 |
#label: '8-Plane' |
|
1130 |
#translateLabel: true |
|
1131 |
#value: #colorMapMode: |
|
1132 |
#activeHelpKey: #colorMap8 |
|
1133 |
#argument: '8-plane' |
|
1134 |
#choice: #colorMapMode |
|
1135 |
#choiceValue: '8-plane' |
|
1136 |
) |
|
1137 |
#(#MenuItem |
|
1138 |
#label: '4-Plane' |
|
1139 |
#translateLabel: true |
|
1140 |
#value: #colorMapMode: |
|
1141 |
#activeHelpKey: #colorMap4 |
|
1142 |
#argument: '4-plane' |
|
1143 |
#choice: #colorMapMode |
|
1144 |
#choiceValue: '4-plane' |
|
1145 |
) |
|
1146 |
#(#MenuItem |
|
1147 |
#label: '2-Plane' |
|
1148 |
#translateLabel: true |
|
1149 |
#value: #colorMapMode: |
|
1150 |
#activeHelpKey: #colorMap2 |
|
1151 |
#argument: '2-plane' |
|
1152 |
#choice: #colorMapMode |
|
1153 |
#choiceValue: '2-plane' |
|
1154 |
) |
|
1155 |
#(#MenuItem |
|
1156 |
#label: '1-Plane' |
|
1157 |
#translateLabel: true |
|
1158 |
#value: #colorMapMode: |
|
1159 |
#activeHelpKey: #colorMap1 |
|
1160 |
#argument: '1-plane' |
|
1161 |
#choice: #colorMapMode |
|
1162 |
#choiceValue: '1-plane' |
|
1163 |
) |
|
1164 |
#(#MenuItem |
|
1165 |
#label: '-' |
|
1166 |
) |
|
1167 |
#(#MenuItem |
|
1168 |
#label: '8-Plane + Mask' |
|
1169 |
#translateLabel: true |
|
1170 |
#value: #colorMapMode: |
|
1171 |
#activeHelpKey: #colorMap8M |
|
1172 |
#argument: '8-plane + mask' |
|
1173 |
#choice: #colorMapMode |
|
1174 |
#choiceValue: '8-plane + mask' |
|
1175 |
) |
|
1176 |
#(#MenuItem |
|
1177 |
#label: '4-Plane + Mask' |
|
1178 |
#translateLabel: true |
|
1179 |
#value: #colorMapMode: |
|
1180 |
#activeHelpKey: #colorMap4M |
|
1181 |
#argument: '4-plane + mask' |
|
1182 |
#choice: #colorMapMode |
|
1183 |
#choiceValue: '4-plane + mask' |
|
737 | 1184 |
) |
1124 | 1185 |
#(#MenuItem |
1186 |
#label: '2-Plane + Mask' |
|
1187 |
#translateLabel: true |
|
1188 |
#value: #colorMapMode: |
|
1189 |
#activeHelpKey: #colorMap2M |
|
1190 |
#argument: '2-plane + mask' |
|
1191 |
#choice: #colorMapMode |
|
1192 |
#choiceValue: '2-plane + mask' |
|
1193 |
) |
|
1194 |
#(#MenuItem |
|
1195 |
#label: '1-Plane + Mask' |
|
1196 |
#translateLabel: true |
|
1197 |
#value: #colorMapMode: |
|
1198 |
#activeHelpKey: #colorMap1M |
|
1199 |
#argument: '1-plane + mask' |
|
1200 |
#choice: #colorMapMode |
|
1201 |
#choiceValue: '1-plane + mask' |
|
1202 |
) |
|
1203 |
#(#MenuItem |
|
1204 |
#label: '-' |
|
1205 |
) |
|
1206 |
#(#MenuItem |
|
1207 |
#label: 'Compress colormap' |
|
1208 |
#translateLabel: true |
|
1209 |
#value: #compressColorMap |
|
1210 |
#activeHelpKey: #compressColormap |
|
1211 |
#enabled: #hasColormap |
|
1212 |
) |
|
1213 |
#(#MenuItem |
|
1214 |
#label: 'Sort colormap' |
|
1215 |
#translateLabel: true |
|
1216 |
#value: #sortColorMap |
|
1217 |
#enabled: #hasColormap |
|
1218 |
) |
|
1219 |
#(#MenuItem |
|
1403 | 1220 |
#label: 'Clear masked pixels' |
1221 |
#translateLabel: true |
|
1222 |
#value: #clearMaskedPixels |
|
1223 |
) |
|
1224 |
#(#MenuItem |
|
1124 | 1225 |
#label: '-' |
1226 |
) |
|
1227 |
#(#MenuItem |
|
1228 |
#label: 'Reduce number of colors...' |
|
1229 |
#translateLabel: true |
|
1230 |
#value: #reduceNumberOfColors |
|
1231 |
) |
|
1232 |
) |
|
1233 |
nil |
|
1234 |
nil |
|
756 | 1235 |
) |
1124 | 1236 |
) |
1237 |
#(#MenuItem |
|
1238 |
#label: 'Settings' |
|
1239 |
#translateLabel: true |
|
1240 |
#submenu: |
|
1241 |
#(#Menu |
|
1242 |
#( |
|
1243 |
#(#MenuItem |
|
1353 | 1244 |
#label: 'Grid Magnification Limit...' |
1124 | 1245 |
#translateLabel: true |
1246 |
#value: #doChangeGridMagnification |
|
1247 |
#activeHelpKey: #settingsGridMagnification |
|
1248 |
) |
|
1249 |
) |
|
1250 |
nil |
|
1251 |
nil |
|
400 | 1252 |
) |
1124 | 1253 |
) |
1254 |
#(#MenuItem |
|
1255 |
#label: 'History' |
|
1256 |
#translateLabel: true |
|
1257 |
#activeHelpKey: #history |
|
1258 |
#submenuChannel: #menuHistory |
|
1259 |
) |
|
1260 |
#(#MenuItem |
|
1261 |
#label: 'Help' |
|
1262 |
#translateLabel: true |
|
1263 |
#startGroup: #right |
|
1264 |
#activeHelpKey: #help |
|
1265 |
#submenuChannel: #menuHelp |
|
1266 |
) |
|
1267 |
) |
|
1268 |
nil |
|
1269 |
nil |
|
400 | 1270 |
) |
1271 |
! |
|
1272 |
||
679 | 1273 |
menuMouseButtonColors |
737 | 1274 |
"This resource specification was automatically generated |
1275 |
by the MenuEditor of ST/X." |
|
679 | 1276 |
|
737 | 1277 |
"Do not manually edit this!! If it is corrupted, |
1278 |
the MenuEditor may not be able to read the specification." |
|
679 | 1279 |
|
1280 |
" |
|
1281 |
MenuEditor new openOnClass:ImageEditor andSelector:#menuMouseButtonColors |
|
1282 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menuMouseButtonColors)) startUp |
|
1283 |
" |
|
1284 |
||
1285 |
<resource: #menu> |
|
1286 |
||
1287 |
^ |
|
1288 |
||
1289 |
#(#Menu |
|
1290 |
||
1291 |
#( |
|
1292 |
#(#MenuItem |
|
1293 |
#label: 'Left Mouse Button' |
|
1294 |
#nameKey: #leftMouseKeyButton |
|
1295 |
#activeHelpKey: #mouseKeyColorMode |
|
975 | 1296 |
#enabled: #imageIsLoaded |
679 | 1297 |
#labelImage: #(#ResourceRetriever nil #leftMouseKeyIcon) |
975 | 1298 |
#choice: #mouseKeyColorMode |
1299 |
#choiceValue: 1 |
|
679 | 1300 |
) |
1301 |
#(#MenuItem |
|
1302 |
#label: 'Right Mouse Button' |
|
1303 |
#nameKey: #rightMouseKeyButton |
|
1304 |
#activeHelpKey: #mouseKeyColorMode |
|
975 | 1305 |
#enabled: #imageIsLoaded |
679 | 1306 |
#labelImage: #(#ResourceRetriever nil #rightMouseKeyIcon) |
975 | 1307 |
#choice: #mouseKeyColorMode |
1308 |
#choiceValue: 2 |
|
679 | 1309 |
) |
1310 |
) nil |
|
1311 |
nil |
|
1312 |
) |
|
1313 |
! |
|
1314 |
||
400 | 1315 |
menuToolbar |
737 | 1316 |
"This resource specification was automatically generated |
1317 |
by the MenuEditor of ST/X." |
|
400 | 1318 |
|
737 | 1319 |
"Do not manually edit this!! If it is corrupted, |
1320 |
the MenuEditor may not be able to read the specification." |
|
400 | 1321 |
|
1322 |
" |
|
1323 |
MenuEditor new openOnClass:ImageEditor andSelector:#menuToolbar |
|
1324 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menuToolbar)) startUp |
|
1325 |
" |
|
1326 |
||
1327 |
<resource: #menu> |
|
1328 |
||
1196 | 1329 |
^ |
1330 |
#(#Menu |
|
1331 |
#( |
|
1332 |
#(#MenuItem |
|
1333 |
#label: 'newImage' |
|
1334 |
#isButton: true |
|
1335 |
#value: #doNewImage |
|
1336 |
#activeHelpKey: #fileNewImage |
|
1337 |
#labelImage: #(#ResourceRetriever #Icon #newIcon) |
|
1338 |
) |
|
1339 |
#(#MenuItem |
|
1340 |
#label: 'loadFromClass' |
|
1341 |
#isButton: true |
|
1342 |
#value: #doLoadFromClass |
|
1343 |
#activeHelpKey: #fileLoadFromClass |
|
1344 |
#labelImage: #(#ResourceRetriever #Icon #loadIcon) |
|
1345 |
) |
|
1346 |
#(#MenuItem |
|
1347 |
#label: 'saveMethod' |
|
1348 |
#isButton: true |
|
1349 |
#value: #doSaveMethod |
|
1350 |
#activeHelpKey: #fileSaveMethod |
|
1351 |
#enabled: #imageIsLoaded |
|
1352 |
#labelImage: #(#ResourceRetriever #Icon #saveIcon) |
|
1353 |
) |
|
1354 |
#(#MenuItem |
|
1355 |
#label: '' |
|
1356 |
) |
|
1357 |
#(#MenuItem |
|
1358 |
#label: '' |
|
1359 |
) |
|
1360 |
#(#MenuItem |
|
1361 |
#label: '' |
|
1362 |
) |
|
1363 |
#(#MenuItem |
|
1364 |
#label: '' |
|
1365 |
) |
|
1366 |
#(#MenuItem |
|
1367 |
#label: 'Point' |
|
1368 |
#activeHelpKey: #drawModePoint |
|
1369 |
#enabled: #imageIsLoaded |
|
1370 |
#choice: #editMode |
|
1371 |
#choiceValue: #point |
|
1372 |
) |
|
1373 |
#(#MenuItem |
|
1374 |
#label: 'Rect' |
|
1375 |
#activeHelpKey: #drawModeBox |
|
1376 |
#enabled: #imageIsLoaded |
|
1377 |
#choice: #editMode |
|
1378 |
#choiceValue: #box |
|
1379 |
) |
|
1380 |
#(#MenuItem |
|
1381 |
#label: 'FillRect' |
|
1382 |
#activeHelpKey: #drawModeFilledBox |
|
1383 |
#enabled: #imageIsLoaded |
|
1384 |
#choice: #editMode |
|
1385 |
#choiceValue: #filledBox |
|
1386 |
) |
|
1387 |
#(#MenuItem |
|
1388 |
#label: 'Fill' |
|
1389 |
#activeHelpKey: #drawModeFill |
|
1390 |
#enabled: #imageIsLoaded |
|
1391 |
#choice: #editMode |
|
1392 |
#choiceValue: #fill |
|
1393 |
) |
|
1394 |
#(#MenuItem |
|
1395 |
#label: 'Copy' |
|
1396 |
#activeHelpKey: #drawModeCopy |
|
1397 |
#enabled: #imageIsLoaded |
|
1398 |
#choice: #editMode |
|
1399 |
#choiceValue: #copy |
|
1400 |
) |
|
1401 |
#(#MenuItem |
|
1402 |
#label: 'Paste' |
|
1403 |
#activeHelpKey: #drawModePaste |
|
1404 |
#enabled: #imageIsLoaded |
|
1405 |
#choice: #editMode |
|
1406 |
#choiceValue: #paste |
|
1407 |
) |
|
1408 |
#(#MenuItem |
|
1409 |
#label: 'Paste Under' |
|
1410 |
#activeHelpKey: #drawModePasteUnder |
|
1411 |
#enabled: #imageIsLoaded |
|
1412 |
#choice: #editMode |
|
1413 |
#choiceValue: #pasteUnder |
|
1414 |
) |
|
1411 | 1415 |
#(#MenuItem |
1416 |
#label: 'Special' |
|
1417 |
#activeHelpKey: #drawModeSpecial |
|
1418 |
#enabled: #imageIsLoaded |
|
1419 |
#choice: #editMode |
|
1420 |
#choiceValue: #specialOperation |
|
1421 |
) |
|
1196 | 1422 |
) |
1423 |
nil |
|
1424 |
nil |
|
400 | 1425 |
) |
1426 |
! ! |
|
1427 |
||
1428 |
!ImageEditor methodsFor:'accessing'! |
|
1429 |
||
1430 |
image |
|
767 | 1431 |
"returns the current editing image" |
400 | 1432 |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1433 |
^ imageEditView image |
400 | 1434 |
! |
1435 |
||
1436 |
postOpenAction: anAction |
|
767 | 1437 |
"sets an action which is evaluated after opening" |
400 | 1438 |
|
1439 |
postOpenAction := anAction |
|
1381 | 1440 |
! |
1441 |
||
1442 |
resourceClass:aClass |
|
1443 |
imageEditView resourceClass:aClass |
|
400 | 1444 |
! ! |
1445 |
||
1398 | 1446 |
!ImageEditor methodsFor:'accessing-views'! |
400 | 1447 |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1448 |
colorDataSetView |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1449 |
"returns the view of the colormap" |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1450 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1451 |
^(builder componentAt: #colorDataSetView) |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1452 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1453 |
"Created: / 26.7.1998 / 12:02:14 / cg" |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1454 |
! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1455 |
|
487 | 1456 |
coordLabel |
767 | 1457 |
"returns the view the coord label" |
487 | 1458 |
|
1459 |
^builder componentAt: #coordLabel |
|
1460 |
! |
|
1461 |
||
400 | 1462 |
imageEditView |
911 | 1463 |
"returns the view of the image" |
400 | 1464 |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1465 |
imageEditView isNil ifTrue:[ |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1466 |
imageEditView := (builder componentAt: #imageEditView) scrolledView. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1467 |
imageEditView addDependent:self. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1468 |
]. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1469 |
^ imageEditView |
1345 | 1470 |
|
1471 |
"Modified: / 10.2.2000 / 23:19:20 / cg" |
|
400 | 1472 |
! |
1473 |
||
1474 |
imagePreView |
|
767 | 1475 |
"returns the preview of the image" |
400 | 1476 |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1477 |
^ (builder componentAt: #imagePreView) subViews first |
475 | 1478 |
! ! |
1479 |
||
400 | 1480 |
!ImageEditor methodsFor:'aspects'! |
1481 |
||
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1482 |
activityInfoHolder |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1483 |
^ self valueOfInfoLabel |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1484 |
|
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1485 |
"Modified: / 29.7.1998 / 18:49:03 / cg" |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1486 |
! |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1487 |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1488 |
colorColumnAdaptor |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1489 |
^ self |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1490 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1491 |
"Created: / 26.7.1998 / 12:17:03 / cg" |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1492 |
! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1493 |
|
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1494 |
hasClassAndSelectorDefined |
1054 | 1495 |
^ [ |
1496 |
|clsName| |
|
1497 |
||
1498 |
(clsName := imageEditView resourceClass) size > 0 |
|
1499 |
and:[(Smalltalk at:clsName ifAbsent:nil) notNil |
|
1500 |
and:[imageEditView resourceSelector notNil]] |
|
1501 |
] |
|
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1502 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1503 |
"Created: / 31.7.1998 / 02:02:54 / cg" |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1504 |
! |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1505 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1506 |
hasClassDefined |
1054 | 1507 |
^ [ |
1508 |
|clsName| |
|
1509 |
||
1510 |
(clsName := imageEditView resourceClass) > 0 |
|
1511 |
and:[(Smalltalk at:clsName ifAbsent:nil) notNil] |
|
1512 |
] |
|
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1513 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1514 |
"Created: / 31.7.1998 / 02:02:22 / cg" |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1515 |
! |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1516 |
|
1008 | 1517 |
hasColormap |
1518 |
^ [self image notNil and:[self image colorMap notNil]] |
|
1519 |
||
1520 |
"Created: / 30.9.1998 / 23:53:55 / cg" |
|
1521 |
! |
|
1522 |
||
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1523 |
imageHasNextImage |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1524 |
"returns whether an image is loaded as value holder" |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1525 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1526 |
^ [self image notNil |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1527 |
and:[self image imageSequence notNil]] |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1528 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1529 |
"Created: / 31.7.1998 / 02:04:18 / cg" |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1530 |
! |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1531 |
|
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1532 |
imageInfoHolder |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1533 |
|holder| |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1534 |
(holder := builder bindingAt:#imageInfoHolder) isNil ifTrue:[ |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1535 |
builder aspectAt:#imageInfoHolder put:(holder := '' asValue). |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1536 |
]. |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1537 |
^ holder |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1538 |
|
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1539 |
"Modified: / 29.7.1998 / 18:32:08 / cg" |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1540 |
! |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1541 |
|
400 | 1542 |
imageIsLoaded |
767 | 1543 |
"returns whether an image is loaded as value holder" |
400 | 1544 |
|
1545 |
|holder| |
|
1546 |
(holder := builder bindingAt:#imageIsLoaded) isNil ifTrue:[ |
|
1547 |
builder aspectAt:#imageIsLoaded put:(holder := false asValue). |
|
1548 |
]. |
|
1549 |
^ holder |
|
1550 |
! |
|
1551 |
||
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1552 |
imageIsLoadedAndClassDefined |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1553 |
"returns whether an image is loaded as value holder" |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1554 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1555 |
^ [self hasClassAndSelectorDefined value |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1556 |
and:[self imageIsLoaded value]] |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1557 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1558 |
"Created: / 31.7.1998 / 02:04:18 / cg" |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1559 |
! |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1560 |
|
400 | 1561 |
listOfColors |
767 | 1562 |
"returns the list of colors in a List" |
400 | 1563 |
|
1564 |
|holder| |
|
1565 |
(holder := builder bindingAt:#listOfColors) isNil ifTrue:[ |
|
1566 |
builder aspectAt:#listOfColors put:(holder := List new). |
|
942 | 1567 |
holder addDependent:self. |
400 | 1568 |
]. |
1569 |
^ holder |
|
1570 |
! |
|
1571 |
||
1572 |
selectionOfColor |
|
767 | 1573 |
"returns current selection of the edit color as an AspectAdaptor" |
400 | 1574 |
|
1575 |
|holder| |
|
1576 |
(holder := builder bindingAt:#selectionOfColor) isNil ifTrue:[ |
|
1577 |
builder aspectAt:#selectionOfColor put:( |
|
1578 |
holder := AspectAdaptor new subject:self; forAspect:#selectedColorIndex). |
|
1579 |
]. |
|
1580 |
^ holder |
|
1581 |
! |
|
1582 |
||
1583 |
valueOfMagnification |
|
767 | 1584 |
"returns current magnification of the image as an AspectAdaptor" |
400 | 1585 |
|
1586 |
|holder| |
|
1587 |
(holder := builder bindingAt:#valueOfMagnification) isNil ifTrue:[ |
|
1588 |
builder aspectAt:#valueOfMagnification put:( |
|
1589 |
holder := AspectAdaptor new subject:self; forAspect:#magnification) |
|
1590 |
]. |
|
1591 |
^ holder |
|
1592 |
! ! |
|
1593 |
||
767 | 1594 |
!ImageEditor methodsFor:'change & update'! |
1595 |
||
1596 |
findColorMapMode |
|
899 | 1597 |
"finds the colorMapMode for a new image" |
767 | 1598 |
|
1054 | 1599 |
|image listOfColors| |
1600 |
||
1601 |
image := self image. |
|
1602 |
image depth > 8 ifTrue: [ |
|
1603 |
colorMapMode value: ''. |
|
1604 |
self listOfColors removeAll. |
|
1605 |
^ nil |
|
1606 |
]. |
|
1607 |
||
1608 |
colorMapMode value:(image depth printString, '-plane'). |
|
1609 |
||
1610 |
(listOfColors := self listOfColors) isEmpty ifTrue:[ |
|
1611 |
self colorMapMode: colorMapMode value. |
|
1612 |
listOfColors := self listOfColors. |
|
1613 |
image := self image. |
|
767 | 1614 |
]. |
1054 | 1615 |
imageEditView selectColors: (Array |
1616 |
with: (listOfColors at:1) |
|
1617 |
with: (listOfColors at:2 ifAbsent:[listOfColors at:1])). |
|
1618 |
||
1619 |
image mask notNil ifTrue: [ |
|
1620 |
colorMapMode value:(colorMapMode value, ' + mask'). |
|
1621 |
||
1622 |
(listOfColors detect: [:clr| clr = (Color basicNew setColorId:0)] ifNone: nil) isNil |
|
1623 |
ifTrue:[ |
|
1624 |
listOfColors addFirst: (Color basicNew setColorId:0). |
|
1625 |
imageEditView selectColors: (Array |
|
1626 |
with:(listOfColors at:2 ifAbsent:[listOfColors at: 1]) |
|
1627 |
with: (listOfColors at: 1)). |
|
898 | 1628 |
] |
767 | 1629 |
]. |
1054 | 1630 |
self selectionOfColor |
1631 |
value: 0; |
|
1632 |
value: (self listOfColors indexOf: imageEditView selectedColor). |
|
767 | 1633 |
! |
1634 |
||
942 | 1635 |
update:something with:aParameter from:changedObject |
960 | 1636 |
|clrIndex| |
1637 |
||
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1638 |
changedObject == self listOfColors ifTrue:[ |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1639 |
something == #at: ifTrue:[ |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1640 |
"/ colormap entry changed at aParameter |
960 | 1641 |
|
1642 |
clrIndex := aParameter. |
|
1643 |
(self hasMask) ifTrue:[ |
|
1644 |
clrIndex := clrIndex - 1. |
|
1645 |
]. |
|
1646 |
||
1647 |
self image colorMap at:clrIndex put:(changedObject at:aParameter). |
|
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1648 |
self colorMapChanged. |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1649 |
^ self |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1650 |
]. |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1651 |
]. |
1124 | 1652 |
|
1653 |
changedObject == imageEditView undoImages ifTrue:[ |
|
1654 |
self valueOfCanUndo value:(changedObject notEmpty). |
|
1655 |
^ self. |
|
1656 |
]. |
|
1657 |
||
1345 | 1658 |
changedObject == imageEditView ifTrue:[ |
1659 |
something == #imageColors ifTrue:[ |
|
1660 |
self listOfColors contents:self image colorMap. |
|
1661 |
self findColorMapMode. |
|
1662 |
^ self. |
|
1663 |
]. |
|
1664 |
something == #image ifTrue:[ |
|
1665 |
self imagePreView image:self image. |
|
1666 |
^ self. |
|
1667 |
]. |
|
1668 |
something == #subImageIn ifTrue:[ |
|
1406 | 1669 |
self imagePreView image ~~ self image ifTrue:[ |
1670 |
self halt:'should not happen'. |
|
1671 |
]. |
|
1345 | 1672 |
self imagePreView redraw:aParameter. |
1673 |
^ self. |
|
1674 |
]. |
|
1675 |
||
1676 |
^ self. |
|
1677 |
]. |
|
1678 |
||
1679 |
changedObject == imageEditView image ifTrue:[ |
|
1377 | 1680 |
self halt:'to be implemented'. |
1345 | 1681 |
^ self. |
1682 |
]. |
|
1683 |
||
942 | 1684 |
super update:something with:aParameter from:changedObject |
1685 |
||
1345 | 1686 |
"Modified: / 10.2.2000 / 23:36:49 / cg" |
942 | 1687 |
! |
1688 |
||
1054 | 1689 |
updateForNoImage |
767 | 1690 |
"updates channels and view, if image is loaded" |
1691 |
||
1692 |
self imageIsLoaded value: false. |
|
1693 |
self listOfColors removeAll. |
|
1694 |
self imagePreView image: nil |
|
1695 |
||
1696 |
||
1697 |
||
1698 |
||
1699 |
! |
|
1700 |
||
1701 |
updateLabelsAndHistory |
|
1702 |
"updates labels and history, if something has changed" |
|
1703 |
||
1704 |
self imageIsLoaded value: self image notNil. |
|
1705 |
||
1706 |
self image isNil ifTrue: [^nil]. |
|
1707 |
||
1708 |
self updateInfoLabel. |
|
1709 |
||
911 | 1710 |
imageEditView resourceMessage asCollectionOfWords size = 2 |
1711 |
ifTrue: [self addToHistory: imageEditView resourceMessage -> #loadFromMessage:]. |
|
767 | 1712 |
|
1713 |
self image fileName notNil |
|
1714 |
ifTrue: [self addToHistory: self image fileName -> #loadFromFile:]. |
|
1715 |
||
1716 |
||
1717 |
||
1718 |
! ! |
|
1719 |
||
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1720 |
!ImageEditor methodsFor:'data access'! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1721 |
|
942 | 1722 |
blueAtColor:aColor put:newBlue |
1723 |
"helper used to return a new row element, when blue is changed" |
|
1724 |
||
1725 |
|byte| |
|
1726 |
||
1727 |
aColor isNil ifTrue:[^ aColor]. "/ mask cannot be changed |
|
1728 |
byte := newBlue clampBetween:0 and:255. |
|
960 | 1729 |
byte = aColor blueByte ifTrue:[^ aColor]. |
942 | 1730 |
^ Color redByte:(aColor redByte) greenByte:(aColor greenByte) blueByte:byte |
960 | 1731 |
|
1732 |
"Modified: / 18.8.1998 / 17:00:12 / cg" |
|
942 | 1733 |
! |
1734 |
||
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1735 |
blueFromColor:aColor |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1736 |
"helper used to access a color as a row in the dataSet view" |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1737 |
|
930 | 1738 |
aColor isNil ifTrue:[^ 'none']. |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1739 |
^ aColor blueByte ? 'mask' |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1740 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1741 |
"Created: / 26.7.1998 / 12:30:35 / cg" |
930 | 1742 |
"Modified: / 31.7.1998 / 01:11:18 / cg" |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1743 |
! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1744 |
|
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1745 |
canSelectBlueInColor:aColor |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1746 |
^ aColor blueByte notNil |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1747 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1748 |
"Created: / 7.8.1998 / 22:50:34 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1749 |
"Modified: / 7.8.1998 / 22:52:57 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1750 |
! |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1751 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1752 |
canSelectGreenInColor:aColor |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1753 |
^ aColor greenByte notNil |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1754 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1755 |
"Created: / 7.8.1998 / 22:50:22 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1756 |
"Modified: / 7.8.1998 / 22:52:46 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1757 |
! |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1758 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1759 |
canSelectRedInColor:aColor |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1760 |
^ aColor redByte notNil |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1761 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1762 |
"Created: / 7.8.1998 / 22:50:00 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1763 |
"Modified: / 7.8.1998 / 22:51:03 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1764 |
! |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1765 |
|
942 | 1766 |
greenAtColor:aColor put:newGreen |
1767 |
"helper used to return a new row element, when green is changed" |
|
1768 |
||
1769 |
|byte| |
|
1770 |
||
1771 |
aColor isNil ifTrue:[^ aColor]. "/ mask cannot be changed |
|
1772 |
byte := newGreen clampBetween:0 and:255. |
|
960 | 1773 |
byte = aColor greenByte ifTrue:[^ aColor]. |
942 | 1774 |
^ Color redByte:(aColor redByte) greenByte:byte blueByte:(aColor blueByte) |
960 | 1775 |
|
1776 |
"Modified: / 18.8.1998 / 17:00:38 / cg" |
|
942 | 1777 |
! |
1778 |
||
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1779 |
greenFromColor:aColor |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1780 |
"helper used to access a color as a row in the dataSet view" |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1781 |
|
930 | 1782 |
aColor isNil ifTrue:[^ 'none']. |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1783 |
^ aColor greenByte ? 'mask' |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1784 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1785 |
"Created: / 26.7.1998 / 12:30:29 / cg" |
930 | 1786 |
"Modified: / 31.7.1998 / 01:11:31 / cg" |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1787 |
! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1788 |
|
942 | 1789 |
redAtColor:aColor put:newRed |
1790 |
"helper used to return a new row element, when red is changed" |
|
1791 |
||
1792 |
|byte| |
|
1793 |
||
1794 |
aColor isNil ifTrue:[^ aColor]. "/ mask cannot be changed |
|
1795 |
byte := newRed clampBetween:0 and:255. |
|
960 | 1796 |
byte = aColor redByte ifTrue:[^ aColor]. |
942 | 1797 |
^ Color redByte:byte greenByte:(aColor greenByte) blueByte:(aColor blueByte) |
960 | 1798 |
|
1799 |
"Modified: / 18.8.1998 / 17:00:49 / cg" |
|
942 | 1800 |
! |
1801 |
||
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1802 |
redFromColor:aColor |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1803 |
"helper used to access a color as a row in the dataSet view" |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1804 |
|
930 | 1805 |
aColor isNil ifTrue:[^ 'none']. |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1806 |
^ aColor redByte ? 'mask' |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1807 |
|
930 | 1808 |
"Modified: / 31.7.1998 / 01:11:35 / cg" |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1809 |
! ! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1810 |
|
672 | 1811 |
!ImageEditor methodsFor:'help'! |
1812 |
||
1813 |
defaultInfoLabel |
|
767 | 1814 |
"returns the default info label" |
672 | 1815 |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1816 |
|resourceClass| |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1817 |
|
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1818 |
resourceClass := imageEditView resourceClass. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1819 |
(resourceClass isSymbol and: [(Smalltalk at:resourceClass) isClass]) |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1820 |
ifTrue:[ |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1821 |
^ resourceClass, ' >> ', imageEditView resourceSelector |
672 | 1822 |
]. |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1823 |
^ 'No class and selector defined.' |
674 | 1824 |
! |
1825 |
||
702 | 1826 |
openDocumentation |
767 | 1827 |
"opens the documentation file of the Image Editor" |
674 | 1828 |
|
763 | 1829 |
self openHTMLDocument: 'tools/uipainter/ImageEditor.html' |
1830 |
||
672 | 1831 |
! ! |
1832 |
||
767 | 1833 |
!ImageEditor methodsFor:'loading'! |
1834 |
||
1835 |
loadFromFile: aFileName |
|
1836 |
"loads an image from aFileName and sets up color map list and other info labels" |
|
1837 |
||
960 | 1838 |
|img| |
1839 |
||
980
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
1840 |
self withCursor:Cursor wait do:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
1841 |
(imageEditView loadFromFile: aFileName) notNil ifTrue:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
1842 |
(img := self image) notNil ifTrue:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
1843 |
img colorMap notNil ifTrue:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
1844 |
self listOfColors contents:(img usedColors asSet asOrderedCollection). |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
1845 |
] ifFalse:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
1846 |
self listOfColors removeAll. |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
1847 |
]. |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
1848 |
self findColorMapMode. |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
1849 |
self updateLabelsAndHistory. |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1850 |
img := img onDevice:device. |
1057 | 1851 |
imageEditView image:img. |
960 | 1852 |
] ifFalse:[ |
1054 | 1853 |
self updateForNoImage |
1057 | 1854 |
]. |
767 | 1855 |
] |
1856 |
] |
|
960 | 1857 |
|
1057 | 1858 |
"Modified: / 16.3.1999 / 21:44:26 / cg" |
767 | 1859 |
! |
1860 |
||
960 | 1861 |
loadFromImage:anImage |
767 | 1862 |
"loads an image from anImage and sets up color map list and other info labels" |
1863 |
||
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1864 |
|img| |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1865 |
|
1057 | 1866 |
anImage notNil ifTrue:[ |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1867 |
img := anImage onDevice:device. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1868 |
]. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1869 |
|
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1870 |
imageEditView image:img. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1871 |
|
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1872 |
img notNil ifTrue:[ |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1873 |
img colorMap notNil ifTrue:[ |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1874 |
self listOfColors contents:(img usedColors asSet asOrderedCollection). |
960 | 1875 |
] ifFalse:[ |
767 | 1876 |
self listOfColors removeAll. |
1877 |
]. |
|
1878 |
self findColorMapMode. |
|
1879 |
self updateLabelsAndHistory. |
|
960 | 1880 |
] ifFalse:[ |
1054 | 1881 |
self updateForNoImage |
767 | 1882 |
] |
960 | 1883 |
|
1057 | 1884 |
"Modified: / 16.3.1999 / 21:43:56 / cg" |
767 | 1885 |
! |
1886 |
||
1887 |
loadFromMessage: aMessage |
|
1888 |
"loads an image by evaluating aMessage and sets up color map list and other info labels" |
|
1889 |
||
960 | 1890 |
|img| |
1891 |
||
1892 |
(imageEditView loadFromMessage: aMessage) notNil ifTrue:[ |
|
1893 |
(img := self image) notNil ifTrue:[ |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1894 |
img := img onDevice:device. |
960 | 1895 |
self listOfColors contents:(img usedColors asSet asOrderedCollection). |
767 | 1896 |
self findColorMapMode. |
1897 |
self updateLabelsAndHistory. |
|
1057 | 1898 |
imageEditView image:img. |
960 | 1899 |
] ifFalse:[ |
1054 | 1900 |
self updateForNoImage |
767 | 1901 |
] |
1902 |
] |
|
960 | 1903 |
|
1057 | 1904 |
"Modified: / 16.3.1999 / 21:44:41 / cg" |
767 | 1905 |
! |
1906 |
||
1907 |
loadFromOrPrepareForMessage: aMessage |
|
1908 |
"loads an image by evaluating aMessage; |
|
1909 |
if no image could extract from aMessage; do set the class and the selector from |
|
1910 |
the aMessage for a saving at the end of editing" |
|
1911 |
||
911 | 1912 |
(imageEditView loadFromMessage: aMessage) notNil |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1913 |
ifTrue: [ |
767 | 1914 |
self listOfColors contents: self image usedColors asSet asOrderedCollection. |
1915 |
self findColorMapMode. |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1916 |
] ifFalse: [ |
911 | 1917 |
imageEditView resourceMessage: aMessage. |
767 | 1918 |
]. |
1919 |
self updateLabelsAndHistory. |
|
1057 | 1920 |
|
1921 |
"Modified: / 16.3.1999 / 21:45:07 / cg" |
|
767 | 1922 |
! ! |
1923 |
||
400 | 1924 |
!ImageEditor methodsFor:'menu modes'! |
1925 |
||
975 | 1926 |
colorMapMode |
1927 |
"returns colorMapMode" |
|
400 | 1928 |
|
975 | 1929 |
colorMapMode isNil ifTrue: [colorMapMode := '' asValue]. |
400 | 1930 |
|
975 | 1931 |
^colorMapMode |
400 | 1932 |
! |
1933 |
||
975 | 1934 |
editMode |
1935 |
"returns editMode" |
|
400 | 1936 |
|
1054 | 1937 |
editMode isNil ifTrue: [ |
975 | 1938 |
editMode := #point asValue. |
1329 | 1939 |
editMode onChangeEvaluate:[imageEditView editMode:(editMode value)] |
975 | 1940 |
]. |
1941 |
||
1942 |
^editMode |
|
400 | 1943 |
! |
1944 |
||
975 | 1945 |
mouseKeyColorMode |
1946 |
"returns mouseKeyColorMode" |
|
400 | 1947 |
|
1345 | 1948 |
mouseKeyColorMode isNil ifTrue:[ |
975 | 1949 |
mouseKeyColorMode := 1 asValue. |
1345 | 1950 |
mouseKeyColorMode onChangeEvaluate: [ |
1951 |
imageEditView mouseKeyColorMode:mouseKeyColorMode value. |
|
1952 |
self selectionOfColor value: (self listOfColors indexOf:imageEditView selectedColor). |
|
1953 |
] |
|
956 | 1954 |
]. |
400 | 1955 |
|
975 | 1956 |
^mouseKeyColorMode |
1345 | 1957 |
|
1958 |
"Modified: / 10.2.2000 / 23:16:42 / cg" |
|
400 | 1959 |
! ! |
1960 |
||
535 | 1961 |
!ImageEditor methodsFor:'queries'! |
1962 |
||
960 | 1963 |
hasMask |
975 | 1964 |
^ colorMapMode notNil and:[colorMapMode value endsWith:'mask'] |
960 | 1965 |
|
1966 |
"Created: / 18.8.1998 / 17:17:38 / cg" |
|
1967 |
! |
|
1968 |
||
535 | 1969 |
preferredExtent |
767 | 1970 |
"returns the preferred extent" |
535 | 1971 |
|
1972 |
^super preferredExtent max: (Screen current width//3)@(Screen current height//3.5) |
|
1973 |
||
1974 |
||
1975 |
! ! |
|
1976 |
||
400 | 1977 |
!ImageEditor methodsFor:'selection'! |
1978 |
||
1979 |
magnification |
|
767 | 1980 |
"returns the magnification of the image" |
400 | 1981 |
|
911 | 1982 |
self imageEditView isNil ifTrue: [^1]. |
1983 |
^imageEditView magnification x |
|
400 | 1984 |
! |
1985 |
||
1986 |
magnification: aValue |
|
767 | 1987 |
"sets the magnification of the image" |
400 | 1988 |
|
905 | 1989 |
|magnification| |
1990 |
magnification := (aValue ? 1) asPoint. |
|
911 | 1991 |
(magnification = imageEditView magnification or: [magnification = (0@0)]) ifTrue: [^nil]. |
1992 |
imageEditView magnification: magnification |
|
400 | 1993 |
! |
1994 |
||
1995 |
selectedColorIndex |
|
767 | 1996 |
"returns the index of the selected color" |
400 | 1997 |
|
1998 |
^selectedColorIndex |
|
1999 |
! |
|
2000 |
||
2001 |
selectedColorIndex: anIndex |
|
767 | 2002 |
"sets the index of the selected color" |
400 | 2003 |
|
1054 | 2004 |
|clr pixel| |
2005 |
||
2006 |
selectedColorIndex := anIndex. |
|
2007 |
clr := self listOfColors at:anIndex ifAbsent:nil. |
|
2008 |
clr isNil ifTrue:[^ self]. |
|
2009 |
||
1075 | 2010 |
pixel := anIndex - 1. |
1054 | 2011 |
(self listOfColors at:1) = Color noColor ifTrue:[ |
2012 |
anIndex == 1 ifTrue:[ |
|
2013 |
pixel := nil. "/ mask |
|
2014 |
] ifFalse:[ |
|
1075 | 2015 |
pixel := pixel - 1 |
1054 | 2016 |
] |
2017 |
]. |
|
2018 |
imageEditView selectedColorIndex:pixel. |
|
2019 |
imageEditView selectedColor:clr. |
|
400 | 2020 |
|
2021 |
! ! |
|
2022 |
||
2023 |
!ImageEditor methodsFor:'startup / release'! |
|
2024 |
||
2025 |
closeRequest |
|
767 | 2026 |
"close request" |
400 | 2027 |
|
911 | 2028 |
imageEditView checkModified ifTrue:[super closeRequest] |
400 | 2029 |
|
2030 |
! |
|
2031 |
||
2032 |
open |
|
767 | 2033 |
"after opening, sets the masterApplication of the imageEditView to self" |
400 | 2034 |
|
2035 |
super open. |
|
444 | 2036 |
|
911 | 2037 |
imageEditView := (builder componentAt: #imageEditView) subViews first. |
975 | 2038 |
imageEditView masterApplication: self. |
2039 |
||
400 | 2040 |
! |
2041 |
||
2042 |
postOpenWith:aBuilder |
|
767 | 2043 |
"after opening, sets the masterApplication of the imageEditView to self; |
2044 |
evaluate the postOpenAction" |
|
400 | 2045 |
|
911 | 2046 |
imageEditView masterApplication: self. |
1124 | 2047 |
imageEditView undoImages addDependent:self. |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2048 |
imageEditView imageInfoHolder:(self imageInfoHolder). |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2049 |
imageEditView activityInfoHolder:(self activityInfoHolder). |
1345 | 2050 |
imageEditView clickInfoCallBack:[:button :point | |
2051 |
|mouseButtonColorToolBar| |
|
2052 |
||
2053 |
mouseButtonColorToolBar := builder componentAt:#MouseButtonColorToolBar. |
|
2054 |
(mouseButtonColorToolBar itemAt:button) toggleIndication. |
|
2055 |
mouseButtonColorToolBar do: [:i| i updateIndicators]. |
|
2056 |
]. |
|
2057 |
imageEditView addDependent:self. |
|
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2058 |
|
400 | 2059 |
postOpenAction notNil ifTrue: [postOpenAction value]. |
2060 |
||
1250 | 2061 |
super postOpenWith:aBuilder. |
2062 |
||
2063 |
aBuilder keyboardProcessor menuBar:nil. |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2064 |
|
1345 | 2065 |
"Modified: / 10.2.2000 / 23:17:43 / cg" |
400 | 2066 |
! ! |
2067 |
||
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2068 |
!ImageEditor methodsFor:'user actions - colormap'! |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2069 |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2070 |
addColorToColormap |
1057 | 2071 |
|depth img cMap newColorMap newImage oldCListSize newMode| |
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2072 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2073 |
img := self image. |
1054 | 2074 |
depth := img depth. |
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2075 |
cMap := img colorMap. |
1054 | 2076 |
cMap isNil ifTrue:[ |
2077 |
self warn:'Image has no colormap\change colorMap mode first.' withCRs. |
|
2078 |
^ self |
|
2079 |
]. |
|
2080 |
||
2081 |
((depth == 1) |
|
2082 |
or:[cMap size == (1 bitShift:depth)]) ifTrue:[ |
|
2083 |
depth >= 8 ifTrue:[ |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2084 |
self warn:'No space for more colors in colormap.'. |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2085 |
^ self |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2086 |
]. |
1054 | 2087 |
(self confirm:'No space for more colors in colormap.\Change depth first.' withCRs) |
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2088 |
ifFalse:[ |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2089 |
^ self |
1057 | 2090 |
]. |
2091 |
||
2092 |
imageEditView makeUndo. |
|
2093 |
newMode := (depth*2) printString , (colorMapMode value copyFrom:2). |
|
2094 |
self colorMapMode:newMode. |
|
2095 |
] ifFalse:[ |
|
2096 |
imageEditView makeUndo. |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2097 |
]. |
1054 | 2098 |
|
2099 |
cMap := cMap asArray. |
|
2100 |
oldCListSize := self listOfColors size. |
|
2101 |
||
2102 |
"/ (colorMapMode value asString endsWith:'mask') ifTrue:[ |
|
2103 |
"/ cMap last = Color noColor ifTrue:[ |
|
2104 |
"/ cMap := cMap copyWithoutLast:1 |
|
2105 |
"/ ] ifFalse:[ |
|
2106 |
"/ cMap first = Color noColor ifTrue:[ |
|
2107 |
"/ cMap := cMap copyFrom:2 |
|
2108 |
"/ ] |
|
2109 |
"/ ]. |
|
2110 |
"/ ]. |
|
2111 |
"/ |
|
2112 |
||
2113 |
newColorMap := cMap copyWith:(Color black). |
|
2114 |
||
2115 |
newImage := img species new |
|
2116 |
width:img width |
|
2117 |
height:img height |
|
2118 |
depth:depth |
|
2119 |
fromArray:img bits. |
|
2120 |
||
2121 |
newImage colorMap:newColorMap. |
|
2122 |
newImage fileName:img fileName. |
|
2123 |
newImage mask:(img mask copy). |
|
2124 |
||
2125 |
(imageEditView image:newImage) notNil ifTrue:[ |
|
2126 |
self listOfColors contents: newImage colorMap. |
|
2127 |
self findColorMapMode. |
|
2128 |
"/ mhmh - somehow, we get two colors added ... (sigh findColorMapMode adds another one ...) |
|
2129 |
self listOfColors size > (oldCListSize + 1) ifTrue:[ |
|
2130 |
self listOfColors removeLast |
|
2131 |
]. |
|
2132 |
self selectionOfColor value:(self listOfColors size). |
|
2133 |
self updateLabelsAndHistory. |
|
2134 |
] |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2135 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2136 |
"Created: / 12.3.1999 / 00:20:28 / cg" |
1057 | 2137 |
"Modified: / 16.3.1999 / 21:57:26 / cg" |
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2138 |
! |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2139 |
|
1403 | 2140 |
clearMaskedPixels |
2141 |
"clear all masked pixels (to pixelValue 0)" |
|
2142 |
||
2143 |
|depth newColorMap newImage oldImage usedColors oldToNew oldBits newBits tmpBits| |
|
2144 |
||
2145 |
oldImage := self image. |
|
2146 |
||
2147 |
imageEditView makeUndo. |
|
2148 |
||
2149 |
self withExecuteCursorDo:[ |
|
2150 |
newImage := oldImage clearMaskedPixels. |
|
2151 |
(imageEditView image:newImage) notNil ifTrue:[ |
|
2152 |
self listOfColors contents: newImage colorMap. |
|
2153 |
self findColorMapMode. |
|
2154 |
self updateLabelsAndHistory. |
|
2155 |
] |
|
2156 |
] |
|
2157 |
! |
|
2158 |
||
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2159 |
colorMapChanged |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2160 |
|img| |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2161 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2162 |
img := self image. |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2163 |
img release. |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2164 |
|
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2165 |
self imageEditView invalidate. |
960 | 2166 |
self imagePreView invalidate. |
2167 |
||
2168 |
"/ (imageEditView image:img) notNil ifTrue:[ |
|
2169 |
"/ self updateLabelsAndHistory. |
|
2170 |
"/ self imagePreView image:img |
|
2171 |
"/ ] |
|
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2172 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2173 |
"Created: / 7.8.1998 / 22:26:10 / cg" |
960 | 2174 |
"Modified: / 18.8.1998 / 17:08:55 / cg" |
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2175 |
! |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2176 |
|
975 | 2177 |
colorMapMode:aMode |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2178 |
"calculates a new color map for the image from aMode" |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2179 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2180 |
|depth numColors newColorMap newImage |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2181 |
oldImage image newColors realColorMap oldFileName |
1008 | 2182 |
usedColors useNearest usageCounts tmpBits tmpMap quest |
2183 |
prevMode maskThreshold maskImage| |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2184 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2185 |
self withExecuteCursorDo:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2186 |
oldImage := self image. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2187 |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2188 |
prevMode := colorMapMode value. |
1008 | 2189 |
oldImage depth > 8 ifTrue:[ |
2190 |
prevMode := nil |
|
2191 |
]. |
|
2192 |
||
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2193 |
newColorMap := self class listOfColorMaps at:aMode. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2194 |
depth := (newColorMap size log: 2) asInteger. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2195 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2196 |
useNearest := false. |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2197 |
depth == 1 ifTrue:[ |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2198 |
quest := 'Keep colormap (or use standard B&W)' |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2199 |
] ifFalse:[ |
1008 | 2200 |
prevMode isNil ifTrue:[ |
2201 |
quest := 'Compute colormap (or use standard)' |
|
2202 |
] ifFalse:[ |
|
2203 |
quest := 'Keep colormap (or use standard)' |
|
2204 |
] |
|
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2205 |
]. |
1008 | 2206 |
((prevMode = aMode) |
1057 | 2207 |
or:[depth > oldImage depth |
2208 |
or:[self confirm:(resources string:quest)]]) ifTrue:[ |
|
1008 | 2209 |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2210 |
"/ keep the colormap |
1008 | 2211 |
newColorMap atAllPut:Color black. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2212 |
depth > oldImage depth ifTrue:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2213 |
"/ easy - simply copy the part |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2214 |
numColors := 1 bitShift:oldImage depth. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2215 |
0 to:numColors-1 do:[:pixel | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2216 |
newColorMap at:(pixel+1) put:(oldImage colorFromValue:pixel) |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2217 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2218 |
] ifFalse:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2219 |
"/ see if all used color fit the new colormap |
986 | 2220 |
usedColors := oldImage usedColorsMax:(1 bitShift:depth). |
1403 | 2221 |
(usedColors notNil and:[usedColors size > (1 bitShift:depth)]) ifTrue:[ |
2222 |
usedColors := oldImage realUsedColors |
|
2223 |
]. |
|
986 | 2224 |
(usedColors notNil and:[usedColors size <= (1 bitShift:depth)]) ifTrue:[ |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2225 |
"/ yea - just install them |
986 | 2226 |
usedColors asArray keysAndValuesDo:[:idx :clr | |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2227 |
newColorMap at:idx put:clr |
1008 | 2228 |
]. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2229 |
] ifFalse:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2230 |
"/ copy over those that are most often used. |
986 | 2231 |
oldImage depth < 8 ifTrue:[ |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2232 |
tmpBits := ByteArray uninitializedNew:(oldImage width*oldImage height). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2233 |
oldImage bits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2234 |
expandPixels:(oldImage depth) |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2235 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2236 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2237 |
into:tmpBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2238 |
mapping:nil. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2239 |
] ifFalse:[ |
986 | 2240 |
oldImage depth == 8 ifTrue:[ |
2241 |
tmpBits := oldImage bits |
|
2242 |
] ifFalse:[ |
|
1124 | 2243 |
colorMapMode value:prevMode. |
1123 | 2244 |
self warn:('Too many colors in image ( ', oldImage usedColors size printString , ').'). |
986 | 2245 |
^ self |
2246 |
] |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2247 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2248 |
usageCounts := tmpBits usageCounts. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2249 |
tmpMap := Array new:usageCounts size. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2250 |
oldImage colorMap asArray keysAndValuesDo:[:i :clr | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2251 |
tmpMap at:i put:clr |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2252 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2253 |
usageCounts sort:[:a :b | a > b] with:tmpMap. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2254 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2255 |
1 to:(1 bitShift:depth) do:[:idx | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2256 |
newColorMap at:idx put:(tmpMap at:idx) |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2257 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2258 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2259 |
useNearest := Dialog |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2260 |
confirmWithCancel:(resources |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2261 |
string:'Image requires %1 colors.\ColorMap has only space for %2\\Use nearest (or map to first color) ?' |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2262 |
with:usedColors size |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2263 |
with:(1 bitShift:depth)) withCRs |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2264 |
labels:(resources array:#('cancel' 'first' 'nearest')). |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2265 |
useNearest isNil ifTrue:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2266 |
^ self "/ cancel |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2267 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2268 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2269 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2270 |
] ifFalse:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2271 |
"/ standard colormap |
921
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2272 |
usedColors := oldImage usedColors. |
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2273 |
(usedColors conform:[:clr | newColorMap includes:clr]) ifFalse:[ |
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2274 |
useNearest := Dialog |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2275 |
confirmWithCancel:(resources |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2276 |
string:'Not all colors are present in the new colormap.\\Map missing ones to nearest (or map to first color) ?' |
921
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2277 |
) withCRs |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2278 |
labels:(resources string:#('cancel' 'first' 'nearest')). |
921
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2279 |
useNearest isNil ifTrue:[ |
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2280 |
^ self "/ cancel |
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2281 |
]. |
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2282 |
]. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2283 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2284 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2285 |
imageEditView makeUndo. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2286 |
|
1424
d7367ae7f85e
fixed conversion of 3-3-2 8-bit truecolor images
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
2287 |
newImage := Image newForDepth:depth. |
d7367ae7f85e
fixed conversion of 3-3-2 8-bit truecolor images
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
2288 |
newImage depth:depth. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2289 |
oldFileName := oldImage fileName. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2290 |
|
1008 | 2291 |
Image imageErrorSignal handle:[:ex| |
2292 |
Color colorErrorSignal handle:[:ex| |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2293 |
imageEditView undo. |
1008 | 2294 |
^ self warn:(resources string:'Conversion failed !!') |
2295 |
] do:[ |
|
1393 | 2296 |
newImage := Image newForDepth:depth. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2297 |
newImage width:oldImage width height:oldImage height depth:depth. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2298 |
newImage colorMap:newColorMap. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2299 |
newImage photometric:#palette. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2300 |
newImage bits:(ByteArray new:(newImage bytesPerRow * newImage height)). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2301 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2302 |
oldImage colorsFromX:0 y:0 toX:(oldImage width-1) y:(oldImage height-1) do: |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2303 |
[:x :y :clr | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2304 |
|newColor| |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2305 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2306 |
(newColorMap includes:clr) |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2307 |
ifTrue: [newColor := clr] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2308 |
ifFalse: [ |
1008 | 2309 |
newColor := clr nearestIn:newColorMap. |
2310 |
useNearest ifFalse:[ |
|
2311 |
(newColor deltaFrom:clr) > 0.5 ifTrue:[ |
|
2312 |
newColor := oldImage colorFromValue:0 |
|
2313 |
] |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2314 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2315 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2316 |
newImage colorAtX:x y:y put:newColor. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2317 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2318 |
image := newImage |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2319 |
]. |
1008 | 2320 |
] do:[ |
2321 |
image := newImage fromImage:oldImage |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2322 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2323 |
|
1008 | 2324 |
(aMode asString endsWith:'mask') ifTrue:[ |
2325 |
image mask isNil ifTrue:[ |
|
2326 |
(self confirm:'Generate mask from black ?') ifTrue:[ |
|
2327 |
maskThreshold := 0.1. |
|
2328 |
maskImage := Depth1Image fromImage:(image asThresholdMonochromeImage:maskThreshold). |
|
2329 |
] ifFalse:[ |
|
2330 |
maskImage := Depth1Image extent:image extent. |
|
2331 |
maskImage data:(ByteArray |
|
2332 |
new:(maskImage bytesPerRow * maskImage height) |
|
2333 |
withAll:16rFF). |
|
2334 |
||
2335 |
"/ maskImage fillRectangle:(image bounds) withColor:(Color colorId:1). |
|
2336 |
]. |
|
2337 |
image mask:maskImage. |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2338 |
]. |
1008 | 2339 |
] ifFalse:[ |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2340 |
image mask: nil. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2341 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2342 |
realColorMap := OrderedCollection new. |
1054 | 2343 |
image realColorMap do:[:clr| |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2344 |
(realColorMap includes: clr) ifFalse: [realColorMap add: clr] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2345 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2346 |
newColors := realColorMap copyFrom: 1 to: (newColorMap size min: realColorMap size). |
1054 | 2347 |
newColorMap do:[:clr| |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2348 |
((newColors size < newColorMap size) and: [(newColors includes: clr) not]) |
1054 | 2349 |
ifTrue:[ |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2350 |
newColors add: clr |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2351 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2352 |
]. |
975 | 2353 |
image colorMap: newColors. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2354 |
|
1054 | 2355 |
(imageEditView image: image) notNil ifTrue:[ |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2356 |
image fileName: oldFileName. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2357 |
self listOfColors contents: image colorMap. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2358 |
self findColorMapMode. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2359 |
self updateLabelsAndHistory. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2360 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2361 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2362 |
|
1057 | 2363 |
"Modified: / 16.3.1999 / 21:55:39 / cg" |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2364 |
! |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2365 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2366 |
compressColorMap |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2367 |
"calculates a new color map for the image, using only used colors" |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2368 |
|
927 | 2369 |
|depth newColorMap newImage oldImage usedColors oldToNew oldBits newBits tmpBits| |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2370 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2371 |
oldImage := self image. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2372 |
depth := oldImage depth. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2373 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2374 |
oldImage photometric ~~ #palette ifTrue:[ |
930 | 2375 |
self information:'Compress colorMap: Only palette images have colormaps.'. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2376 |
^ self |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2377 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2378 |
|
1403 | 2379 |
usedColors := oldImage realUsedColors. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2380 |
usedColors size == (1 bitShift:depth) ifTrue:[ |
930 | 2381 |
self information:'Compress colorMap: All colors are used - no compression.'. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2382 |
^ self |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2383 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2384 |
usedColors size == oldImage colorMap size ifTrue:[ |
930 | 2385 |
self information:'Compress colorMap: Colormap already compressed - no compression.'. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2386 |
^ self |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2387 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2388 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2389 |
imageEditView makeUndo. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2390 |
|
930 | 2391 |
self information:('Compress colorMap: %1 colors used.' bindWith:usedColors size). |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2392 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2393 |
self withExecuteCursorDo:[ |
996
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2394 |
"/ newColorMap := Array new:usedColors size. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2395 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2396 |
"/ translation table |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2397 |
oldToNew := ByteArray new:(1 bitShift:depth). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2398 |
newColorMap := usedColors asArray. |
996
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2399 |
newColorMap sort:[:a :b | |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2400 |
a redByte == b redByte ifTrue:[ |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2401 |
a greenByte == b greenByte ifTrue:[ |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2402 |
a blueByte < b blueByte |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2403 |
] ifFalse:[ |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2404 |
a greenByte < b greenByte |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2405 |
] |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2406 |
] ifFalse:[ |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2407 |
a redByte < b redByte |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2408 |
] |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2409 |
]. |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2410 |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2411 |
oldImage colorMap asArray keysAndValuesDo:[:oldIdx :clr | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2412 |
|newPixel| |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2413 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2414 |
(usedColors includes:clr) ifTrue:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2415 |
newPixel := newColorMap indexOf:clr. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2416 |
oldToNew at:oldIdx put:newPixel-1. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2417 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2418 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2419 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2420 |
oldBits := oldImage bits. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2421 |
newBits := ByteArray new:(oldBits size). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2422 |
depth ~~ 8 ifTrue:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2423 |
"/ expand/compress can only handle 8bits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2424 |
tmpBits := ByteArray uninitializedNew:(oldImage width*oldImage height). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2425 |
oldBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2426 |
expandPixels:depth |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2427 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2428 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2429 |
into:tmpBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2430 |
mapping:oldToNew. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2431 |
tmpBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2432 |
compressPixels:depth |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2433 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2434 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2435 |
into:newBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2436 |
mapping:nil |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2437 |
] ifFalse:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2438 |
oldBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2439 |
expandPixels:depth |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2440 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2441 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2442 |
into:newBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2443 |
mapping:oldToNew. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2444 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2445 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2446 |
newImage := oldImage species new |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2447 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2448 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2449 |
depth:depth |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2450 |
fromArray:newBits. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2451 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2452 |
newImage colorMap:newColorMap. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2453 |
newImage fileName:oldImage fileName. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2454 |
newImage mask:(oldImage mask copy). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2455 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2456 |
(imageEditView image:newImage) notNil ifTrue: |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2457 |
[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2458 |
self listOfColors contents: newImage colorMap. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2459 |
self findColorMapMode. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2460 |
self updateLabelsAndHistory. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2461 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2462 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2463 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2464 |
"Created: / 28.7.1998 / 20:03:11 / cg" |
996
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2465 |
"Modified: / 15.9.1998 / 17:53:32 / cg" |
1008 | 2466 |
! |
2467 |
||
1124 | 2468 |
reduceNumberOfColors |
2469 |
|s n anyChange img| |
|
2470 |
||
2471 |
s := Dialog request:'Number of color bits to strip (1-7) ?'. |
|
2472 |
s isNil ifTrue:[^ self]. |
|
2473 |
n := Integer readFrom:s onError:0. |
|
2474 |
(n between:1 and:7) ifFalse:[ |
|
2475 |
Dialog warn:'Image unchanged'. |
|
2476 |
^ self |
|
2477 |
]. |
|
2478 |
||
2479 |
imageEditView makeUndo. |
|
2480 |
self withExecuteCursorDo:[ |
|
2481 |
anyChange := imageEditView reduceColorResolutionBy:n. |
|
2482 |
anyChange ifFalse:[ |
|
2483 |
Dialog warn:'Image unchanged'. |
|
2484 |
] ifTrue:[ |
|
2485 |
img := imageEditView image. |
|
2486 |
imageEditView image:img. |
|
2487 |
self listOfColors contents:(img colorMap). |
|
2488 |
self findColorMapMode. |
|
2489 |
self updateLabelsAndHistory. |
|
2490 |
Dialog information:(img usedColors size printString , ' colors used.') |
|
2491 |
] |
|
2492 |
]. |
|
2493 |
! |
|
2494 |
||
1008 | 2495 |
sortColorMap |
2496 |
"calculates a new color map for the image, sorting colors" |
|
2497 |
||
2498 |
|depth newColorMap newImage oldImage usedColors oldToNew oldBits newBits tmpBits| |
|
2499 |
||
2500 |
oldImage := self image. |
|
2501 |
depth := oldImage depth. |
|
2502 |
||
2503 |
oldImage photometric ~~ #palette ifTrue:[ |
|
2504 |
self information:'Compress colorMap: Only palette images have colormaps.'. |
|
2505 |
^ self |
|
2506 |
]. |
|
2507 |
||
2508 |
usedColors := oldImage realColorMap. |
|
2509 |
||
2510 |
imageEditView makeUndo. |
|
2511 |
||
2512 |
self withExecuteCursorDo:[ |
|
2513 |
"/ newColorMap := Array new:usedColors size. |
|
2514 |
||
2515 |
"/ translation table |
|
2516 |
oldToNew := ByteArray new:(1 bitShift:depth). |
|
2517 |
newColorMap := usedColors asArray. |
|
2518 |
newColorMap sort:[:a :b | |
|
2519 |
a redByte == b redByte ifTrue:[ |
|
2520 |
a greenByte == b greenByte ifTrue:[ |
|
2521 |
a blueByte < b blueByte |
|
2522 |
] ifFalse:[ |
|
2523 |
a greenByte < b greenByte |
|
2524 |
] |
|
2525 |
] ifFalse:[ |
|
2526 |
a redByte < b redByte |
|
2527 |
] |
|
2528 |
]. |
|
2529 |
||
2530 |
oldImage colorMap asArray keysAndValuesDo:[:oldIdx :clr | |
|
2531 |
|newPixel| |
|
2532 |
||
2533 |
(usedColors includes:clr) ifTrue:[ |
|
2534 |
newPixel := newColorMap indexOf:clr. |
|
2535 |
oldToNew at:oldIdx put:newPixel-1. |
|
2536 |
] |
|
2537 |
]. |
|
2538 |
||
2539 |
oldBits := oldImage bits. |
|
2540 |
newBits := ByteArray new:(oldBits size). |
|
2541 |
depth ~~ 8 ifTrue:[ |
|
2542 |
"/ expand/compress can only handle 8bits |
|
2543 |
tmpBits := ByteArray uninitializedNew:(oldImage width*oldImage height). |
|
2544 |
oldBits |
|
2545 |
expandPixels:depth |
|
2546 |
width:oldImage width |
|
2547 |
height:oldImage height |
|
2548 |
into:tmpBits |
|
2549 |
mapping:oldToNew. |
|
2550 |
tmpBits |
|
2551 |
compressPixels:depth |
|
2552 |
width:oldImage width |
|
2553 |
height:oldImage height |
|
2554 |
into:newBits |
|
2555 |
mapping:nil |
|
2556 |
] ifFalse:[ |
|
2557 |
oldBits |
|
2558 |
expandPixels:depth |
|
2559 |
width:oldImage width |
|
2560 |
height:oldImage height |
|
2561 |
into:newBits |
|
2562 |
mapping:oldToNew. |
|
2563 |
]. |
|
2564 |
||
2565 |
newImage := oldImage species new |
|
2566 |
width:oldImage width |
|
2567 |
height:oldImage height |
|
2568 |
depth:depth |
|
2569 |
fromArray:newBits. |
|
2570 |
||
2571 |
newImage colorMap:newColorMap. |
|
2572 |
newImage fileName:oldImage fileName. |
|
2573 |
newImage mask:(oldImage mask copy). |
|
2574 |
||
1054 | 2575 |
(imageEditView image:newImage) notNil ifTrue:[ |
1008 | 2576 |
self listOfColors contents: newImage colorMap. |
2577 |
self findColorMapMode. |
|
2578 |
self updateLabelsAndHistory. |
|
2579 |
] |
|
2580 |
] |
|
2581 |
||
2582 |
"Modified: / 15.9.1998 / 17:53:32 / cg" |
|
2583 |
"Created: / 30.9.1998 / 23:51:23 / cg" |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2584 |
! ! |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2585 |
|
400 | 2586 |
!ImageEditor methodsFor:'user actions - editing'! |
2587 |
||
767 | 2588 |
doBrowseClass |
2589 |
"opens a System Browser on the resourceClass and the resourceSelector" |
|
400 | 2590 |
|
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2591 |
|cls| |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2592 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2593 |
cls := Smalltalk at:(imageEditView resourceClass) ifAbsent:nil. |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2594 |
cls isNil ifTrue:[^ self warn:'No Class specified']. |
1392
f6f7a70c5d41
browserClass from preferences
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
2595 |
UserPreferences current systemBrowserClass |
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2596 |
openInClass:cls class |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2597 |
selector:(imageEditView resourceSelector) |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2598 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2599 |
"Modified: / 31.7.1998 / 02:01:15 / cg" |
400 | 2600 |
! |
2601 |
||
1045 | 2602 |
doCropAll |
986 | 2603 |
"find all borders and cut them off" |
2604 |
||
1045 | 2605 |
imageEditView cropLeft:true right:true top:true bottom:true. |
986 | 2606 |
self updateInfoLabel |
2607 |
||
2608 |
"Modified: / 7.9.1998 / 14:26:23 / cg" |
|
2609 |
"Created: / 7.9.1998 / 16:33:43 / cg" |
|
2610 |
! |
|
2611 |
||
1045 | 2612 |
doCropBottom |
986 | 2613 |
"find a bottom border and cut it off" |
2614 |
||
1045 | 2615 |
imageEditView cropLeft:false right:false top:false bottom:true. |
986 | 2616 |
self updateInfoLabel |
2617 |
||
2618 |
"Created: / 7.9.1998 / 13:00:20 / cg" |
|
2619 |
"Modified: / 7.9.1998 / 14:26:23 / cg" |
|
2620 |
! |
|
2621 |
||
1045 | 2622 |
doCropLeft |
986 | 2623 |
"find a left border and cut it off" |
2624 |
||
1045 | 2625 |
imageEditView cropLeft:true right:false top:false bottom:false. |
986 | 2626 |
self updateInfoLabel |
2627 |
||
2628 |
"Created: / 7.9.1998 / 13:00:14 / cg" |
|
2629 |
"Modified: / 7.9.1998 / 14:26:34 / cg" |
|
2630 |
! |
|
2631 |
||
1045 | 2632 |
doCropManual |
986 | 2633 |
"let user specify borders and cut them off" |
2634 |
||
1383 | 2635 |
|bindings left top right bottom img| |
986 | 2636 |
|
2637 |
bindings := IdentityDictionary new. |
|
2638 |
bindings at:#left put:(left := 0 asValue). |
|
2639 |
bindings at:#right put:(right := 0 asValue). |
|
2640 |
bindings at:#top put:(top := 0 asValue). |
|
2641 |
bindings at:#bottom put:(bottom := 0 asValue). |
|
1045 | 2642 |
(self openDialogInterface:#gropDialogSpec withBindings:bindings) |
986 | 2643 |
ifTrue:[ |
2644 |
left := left value. |
|
2645 |
right := right value. |
|
2646 |
top := top value. |
|
2647 |
bottom := bottom value. |
|
1383 | 2648 |
img := imageEditView image. |
986 | 2649 |
imageEditView |
2650 |
makeSubImageX:left y:top |
|
1383 | 2651 |
width:(img width - left - right) |
2652 |
height:(img height - top - bottom). |
|
986 | 2653 |
self updateInfoLabel |
2654 |
]. |
|
2655 |
||
2656 |
"Created: / 7.9.1998 / 18:16:07 / cg" |
|
2657 |
"Modified: / 7.9.1998 / 18:20:42 / cg" |
|
2658 |
! |
|
2659 |
||
1045 | 2660 |
doCropRight |
986 | 2661 |
"find a right border and cut it off" |
2662 |
||
1045 | 2663 |
imageEditView cropLeft:false right:true top:false bottom:false. |
986 | 2664 |
self updateInfoLabel |
2665 |
||
2666 |
"Created: / 7.9.1998 / 13:00:14 / cg" |
|
2667 |
"Modified: / 7.9.1998 / 14:26:44 / cg" |
|
2668 |
! |
|
2669 |
||
1045 | 2670 |
doCropTop |
986 | 2671 |
"find a top border and cut it off" |
2672 |
||
1045 | 2673 |
imageEditView cropLeft:false right:false top:true bottom:false. |
986 | 2674 |
self updateInfoLabel |
2675 |
||
2676 |
"Created: / 7.9.1998 / 13:00:19 / cg" |
|
2677 |
"Modified: / 7.9.1998 / 14:26:52 / cg" |
|
2678 |
! |
|
2679 |
||
767 | 2680 |
doFlipHorizontal |
2681 |
"flips horizontally current image" |
|
400 | 2682 |
|
911 | 2683 |
imageEditView flipHorizontal |
400 | 2684 |
! |
2685 |
||
767 | 2686 |
doFlipVertical |
2687 |
"flips vertically current image" |
|
400 | 2688 |
|
911 | 2689 |
imageEditView flipVertical |
400 | 2690 |
! |
2691 |
||
767 | 2692 |
doMagnifyDown |
2693 |
"magnifies current image one step down" |
|
400 | 2694 |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2695 |
|magHolder mag| |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2696 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2697 |
magHolder := self valueOfMagnification. |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2698 |
(mag := magHolder value) > 1 ifTrue: [ |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2699 |
magHolder value: mag - 1 |
400 | 2700 |
] |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2701 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2702 |
"Modified: / 26.7.1998 / 20:24:08 / cg" |
400 | 2703 |
! |
2704 |
||
767 | 2705 |
doMagnifyImage |
2706 |
"magnifies current image" |
|
400 | 2707 |
|
1353 | 2708 |
|box newSize image| |
2709 |
||
2710 |
image := imageEditView image. |
|
2711 |
||
2712 |
box := EnterBox new. |
|
2713 |
box title:(resources string:'Images new size:'). |
|
2714 |
box okText:(resources string:'OK'). |
|
2715 |
box abortText:(resources string:'Cancel'). |
|
2716 |
box initialText:image extent printString. |
|
2717 |
box showAtPointer. |
|
2718 |
(box accepted |
|
2719 |
and: [(newSize := Object readFromString:(box contents) onError:nil) notNil]) |
|
2720 |
ifTrue:[ |
|
2721 |
imageEditView magnifyImageTo:newSize. |
|
2722 |
]. |
|
2723 |
||
400 | 2724 |
self updateInfoLabel |
2725 |
! |
|
2726 |
||
767 | 2727 |
doMagnifyUp |
2728 |
"magnifies current image one step up" |
|
400 | 2729 |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2730 |
|magHolder mag| |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2731 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2732 |
magHolder := self valueOfMagnification. |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2733 |
(mag := magHolder value) < 99 ifTrue: [ |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2734 |
magHolder value: mag + 1 |
400 | 2735 |
] |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2736 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2737 |
"Modified: / 26.7.1998 / 20:23:52 / cg" |
400 | 2738 |
! |
2739 |
||
767 | 2740 |
doNegativeImage |
2741 |
"negates current image by negating the color map" |
|
400 | 2742 |
|
911 | 2743 |
imageEditView negativeImage. |
400 | 2744 |
self listOfColors removeAll. |
901 | 2745 |
self findColorMapMode. |
911 | 2746 |
imageEditView undoImages removeLast |
400 | 2747 |
! |
2748 |
||
767 | 2749 |
doResizeImage |
1353 | 2750 |
"resizes the current image" |
2751 |
||
2752 |
|box newSize image| |
|
2753 |
||
2754 |
image := imageEditView image. |
|
2755 |
||
2756 |
box := EnterBox new. |
|
2757 |
box title:(resources string:'Images new size:'). |
|
2758 |
box okText:(resources string:'OK'). |
|
2759 |
box abortText:(resources string:'Cancel'). |
|
2760 |
box initialText:image extent printString. |
|
2761 |
box showAtPointer. |
|
2762 |
(box accepted |
|
2763 |
and: [(newSize := Object readFromString:(box contents) onError:nil) notNil]) |
|
2764 |
ifTrue:[ |
|
2765 |
imageEditView resizeImageTo:newSize. |
|
2766 |
]. |
|
2767 |
||
400 | 2768 |
! |
2769 |
||
767 | 2770 |
doRotateImage |
2771 |
"rotates current image" |
|
400 | 2772 |
|
1353 | 2773 |
|box rotation| |
2774 |
||
2775 |
box := EnterBox new. |
|
2776 |
box title:(resources string:'Rotate by (degrees, clockwise):'). |
|
2777 |
box okText:(resources string:'OK'). |
|
2778 |
box abortText:(resources string:'Cancel'). |
|
2779 |
box initialText: '0'. |
|
2780 |
box showAtPointer. |
|
2781 |
(box accepted and: [(rotation := Object readFromString: box contents onError:nil) notNil]) |
|
2782 |
ifTrue:[ |
|
2783 |
imageEditView rotateImageBy:rotation. |
|
2784 |
self updateInfoLabel |
|
2785 |
]. |
|
400 | 2786 |
! |
2787 |
||
767 | 2788 |
doUndo |
2789 |
"reverses last edit action" |
|
400 | 2790 |
|
911 | 2791 |
imageEditView undo |
400 | 2792 |
! ! |
2793 |
||
2794 |
!ImageEditor methodsFor:'user actions - loading'! |
|
2795 |
||
767 | 2796 |
doLoadFromClass |
2797 |
"opens a dialog for loading an image from class and a (resource-) selector" |
|
400 | 2798 |
|
1122 | 2799 |
|img| |
2800 |
||
1054 | 2801 |
(imageEditView loadFromClass) notNil ifTrue:[ |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2802 |
imageSeqNr := nil. |
1122 | 2803 |
(img := self image) notNil ifTrue: [ |
2804 |
self listOfColors contents: img usedColors asSet asOrderedCollection. |
|
574 | 2805 |
self findColorMapMode. |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2806 |
self updateLabelsAndHistory. |
1054 | 2807 |
] ifFalse: [ |
2808 |
self updateForNoImage |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2809 |
]. |
449 | 2810 |
] |
400 | 2811 |
! |
2812 |
||
767 | 2813 |
doLoadFromFile |
2814 |
"opens a dialog for loading an image from a file" |
|
400 | 2815 |
|
1353 | 2816 |
|img file dir filters| |
2817 |
||
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2818 |
imageSeqNr := nil. |
1353 | 2819 |
img := self image. |
2820 |
img notNil ifTrue: [ |
|
2821 |
file := img fileName |
|
2822 |
] ifFalse:[ |
|
2823 |
dir := LastDirectory |
|
2824 |
]. |
|
2825 |
||
2826 |
filters := FileSelectionBrowser loadImageFileNameFilters. |
|
2827 |
||
2828 |
file notNil ifTrue:[ |
|
2829 |
file := FileSelectionBrowser |
|
2830 |
request:'Load Image From' |
|
2831 |
fileName:file |
|
2832 |
withFileFilters:filters. |
|
2833 |
] ifFalse:[ |
|
2834 |
file := FileSelectionBrowser |
|
2835 |
request:'Load Image From' |
|
2836 |
inDirectory:dir |
|
2837 |
withFileFilters:filters. |
|
2838 |
]. |
|
2839 |
file notNil ifTrue:[ |
|
2840 |
LastDirectory := file asFilename directoryName. |
|
2841 |
self loadFromFile:file |
|
2842 |
] |
|
400 | 2843 |
! |
2844 |
||
767 | 2845 |
doNewImage |
2846 |
"opens a dialog with choices of size and color map for creating a new image" |
|
400 | 2847 |
|
1383 | 2848 |
|aspects width height cMap imageClass image szString| |
2849 |
||
767 | 2850 |
|
400 | 2851 |
aspects := IdentityDictionary new |
767 | 2852 |
at:#listOfSizes put: self class listOfDefaultSizes asValue; |
2853 |
at:#listOfColorMaps put: self class listOfColorMaps keys asSortedCollection asValue; |
|
2854 |
at:#selectionOfSize put: self class listOfDefaultSizes first copy asValue; |
|
400 | 2855 |
at:#selectionOfColorMap put: self class listOfColorMaps keys asSortedCollection first asValue; |
2856 |
yourself. |
|
2857 |
||
767 | 2858 |
(self openDialogInterface:#dialogSpecForNewImage withBindings:aspects) |
1383 | 2859 |
ifTrue:[ |
2860 |
szString := (aspects at:#selectionOfSize) value. |
|
2861 |
width := 128 min: (Integer readFromString: (szString upTo: $x) onError:[24]). |
|
2862 |
height := 128 min: (Integer readFromString: (szString copy reverse upTo: $x) reverse onError:[24]). |
|
400 | 2863 |
|
975 | 2864 |
cMap := (self class listOfColorMaps at: (colorMapMode value: (aspects at:#selectionOfColorMap) value) value). |
400 | 2865 |
imageClass := Image implementorForDepth: ((cMap size log: 2) asInteger). |
767 | 2866 |
image := imageClass width: width height: height fromArray: (ByteArray new: width*height). |
400 | 2867 |
|
975 | 2868 |
(colorMapMode value endsWith: 'mask') |
400 | 2869 |
ifTrue: |
2870 |
[ |
|
767 | 2871 |
image mask: (Depth1Image width: width height: height depth: 1 fromArray: (ByteArray new: width*height)) clearMaskedPixels |
400 | 2872 |
]. |
2873 |
image colorMap: cMap. |
|
2874 |
image fillRectangleX:0 y:0 width:width height:height with:Color white. |
|
911 | 2875 |
(imageEditView image: image) notNil |
400 | 2876 |
ifTrue: |
2877 |
[ |
|
2878 |
self listOfColors contents: cMap. |
|
2879 |
self findColorMapMode. |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2880 |
self updateLabelsAndHistory. |
400 | 2881 |
] |
767 | 2882 |
] |
929 | 2883 |
! |
2884 |
||
2885 |
grabScreenImage |
|
2886 |
"let user choose an area and grab that are for editing" |
|
2887 |
||
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
2888 |
Processor |
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
2889 |
addTimedBlock:[ |
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
2890 |
|image d8image img| |
929 | 2891 |
|
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2892 |
imageSeqNr := nil. |
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
2893 |
image := Image fromUser. |
1121 | 2894 |
image isNil ifFalse:[ |
2895 |
image depth > 8 ifTrue:[ |
|
1122 | 2896 |
Object errorSignal handle:[:ex | |sig| |
2897 |
(sig := ex signal) == Object haltSignal ifTrue:[ex reject]. |
|
2898 |
sig == Signal noHandlerSignal ifTrue:[ex reject]. |
|
1121 | 2899 |
|
2900 |
self warn:'Could not convert to depth8 image (too many colors)'. |
|
2901 |
d8image := nil. |
|
2902 |
] do:[ |
|
2903 |
d8image := Depth8Image new. |
|
2904 |
d8image fromImage:image. |
|
2905 |
]. |
|
2906 |
d8image notNil ifTrue:[ |
|
2907 |
image := d8image |
|
2908 |
] |
|
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
2909 |
]. |
1121 | 2910 |
(imageEditView image:image) notNil ifTrue:[ |
2911 |
self listOfColors contents:(image colorMap). |
|
2912 |
self findColorMapMode. |
|
2913 |
self updateLabelsAndHistory. |
|
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
2914 |
] |
1121 | 2915 |
] |
2916 |
] |
|
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
2917 |
afterSeconds:1 |
929 | 2918 |
|
2919 |
"Created: / 29.7.1998 / 21:24:42 / cg" |
|
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
2920 |
"Modified: / 10.9.1998 / 16:01:23 / cg" |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2921 |
! |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2922 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2923 |
nextImageInSequence |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2924 |
"display the next image in the image sequence" |
1383 | 2925 |
|img seq frame listOfColors| |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2926 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2927 |
imageEditView releaseUndos. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2928 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2929 |
seq := self image imageSequence. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2930 |
imageSeqNr isNil ifTrue:[ |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2931 |
imageSeqNr := 1. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2932 |
]. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2933 |
imageSeqNr := imageSeqNr + 1. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2934 |
imageSeqNr > seq size ifTrue:[ |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2935 |
self information:'Back to first image in sequence'. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2936 |
imageSeqNr := 1. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2937 |
]. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2938 |
frame := seq at:imageSeqNr. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2939 |
imageEditView image:(frame image). |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2940 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2941 |
(img := self image) notNil ifTrue:[ |
1383 | 2942 |
listOfColors := self listOfColors. |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2943 |
img colorMap notNil ifTrue:[ |
1383 | 2944 |
listOfColors contents:(img usedColors asSet asOrderedCollection). |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2945 |
] ifFalse:[ |
1383 | 2946 |
listOfColors removeAll. |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2947 |
]. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2948 |
self findColorMapMode. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2949 |
self updateLabelsAndHistory. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2950 |
img := img onDevice:device. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2951 |
imageEditView image:img. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2952 |
] ifFalse:[ |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2953 |
self updateForNoImage |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2954 |
]. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
2955 |
|
400 | 2956 |
! ! |
2957 |
||
2958 |
!ImageEditor methodsFor:'user actions - saving'! |
|
2959 |
||
767 | 2960 |
doPrint |
2961 |
"prints current image on the current printer" |
|
400 | 2962 |
|
911 | 2963 |
imageEditView print |
400 | 2964 |
! |
2965 |
||
767 | 2966 |
doSaveImageFile |
2967 |
"saves current image to current file" |
|
400 | 2968 |
|
911 | 2969 |
imageEditView save |
400 | 2970 |
! |
2971 |
||
767 | 2972 |
doSaveImageFileAs |
2973 |
"opens a dialog for saving current image to a file" |
|
400 | 2974 |
|
911 | 2975 |
imageEditView saveImageFileAs. |
694 | 2976 |
self updateLabelsAndHistory |
400 | 2977 |
! |
2978 |
||
767 | 2979 |
doSaveImageMaskFileAs |
2980 |
"opens a dialog for saving mask of current image to a file" |
|
400 | 2981 |
|
911 | 2982 |
imageEditView saveImageMaskFileAs |
400 | 2983 |
! |
2984 |
||
767 | 2985 |
doSaveMethod |
2986 |
"saves current image on current class and selector" |
|
400 | 2987 |
|
911 | 2988 |
imageEditView saveMethod notNil |
400 | 2989 |
ifTrue: |
2990 |
[ |
|
694 | 2991 |
self updateLabelsAndHistory |
400 | 2992 |
] |
2993 |
! |
|
2994 |
||
767 | 2995 |
doSaveMethodAs |
2996 |
"opens a dialog for saving current image on a class and a selector" |
|
400 | 2997 |
|
911 | 2998 |
imageEditView saveMethodAs notNil |
400 | 2999 |
ifTrue: |
3000 |
[ |
|
694 | 3001 |
self updateLabelsAndHistory |
400 | 3002 |
] |
1309
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3003 |
! |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3004 |
|
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3005 |
doShowStoreString |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3006 |
"opens a dialog showing the storeString |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3007 |
(sometimes useful to embed an image into source code)" |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3008 |
|
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3009 |
|img| |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3010 |
|
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3011 |
img := imageEditView image. |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3012 |
TextBox openOn:img storeString |
400 | 3013 |
! ! |
3014 |
||
1353 | 3015 |
!ImageEditor methodsFor:'user actions - settings'! |
3016 |
||
3017 |
doChangeGridMagnification |
|
3018 |
"change grid magnification" |
|
3019 |
||
3020 |
|box oldGridLimit newGridLimit| |
|
3021 |
||
3022 |
oldGridLimit := imageEditView class gridMagnificationLimit asPoint. |
|
3023 |
||
3024 |
box := EnterBox new. |
|
3025 |
box title:(resources string:'Grid Magnification Limit:'). |
|
3026 |
box okText:(resources string:'OK'). |
|
3027 |
box abortText:(resources string:'Cancel'). |
|
3028 |
box initialText:(oldGridLimit x printString). |
|
3029 |
box showAtPointer. |
|
3030 |
||
3031 |
(box accepted |
|
3032 |
and: [(newGridLimit := Number readFromString:(box contents) onError:[2]) notNil] |
|
3033 |
) ifTrue:[ |
|
3034 |
newGridLimit := (99 min: (2 max:newGridLimit)) asPoint. |
|
3035 |
imageEditView class gridMagnificationLimit:newGridLimit. |
|
3036 |
imageEditView invalidate |
|
3037 |
] |
|
3038 |
||
3039 |
! ! |
|
3040 |
||
400 | 3041 |
!ImageEditor class methodsFor:'documentation'! |
3042 |
||
3043 |
version |
|
3044 |
^ '$Header$' |
|
3045 |
! ! |