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