author | Claus Gittinger <cg@exept.de> |
Mon, 18 Mar 2002 14:07:19 +0100 | |
changeset 1557 | 78409b670c85 |
parent 1556 | 92d3ec7850cd |
child 1558 | 3848cbaaf6d9 |
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' |
1480 | 18 |
classVariableNames:'LastDirectory MaskClipboard' |
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 |
||
1545 | 198 |
flyByHelpSpec |
199 |
<resource: #help> |
|
200 |
||
201 |
^super flyByHelpSpec addPairsFrom:#( |
|
202 |
||
203 |
#drawModeBox |
|
204 |
'Rectangle' |
|
205 |
||
206 |
#drawModeCopy |
|
207 |
'Copy' |
|
208 |
||
209 |
#drawModeFill |
|
210 |
'Flood-fill' |
|
211 |
||
212 |
#drawModeFilledBox |
|
213 |
'Fill Rectangle' |
|
214 |
||
215 |
#drawModePaste |
|
216 |
'Paste' |
|
217 |
||
218 |
#drawModePasteUnder |
|
219 |
'Paste under' |
|
220 |
||
221 |
#drawModePoint |
|
222 |
'Point' |
|
223 |
||
224 |
#fileGrabImage |
|
225 |
'Pick from screen.' |
|
226 |
||
227 |
#fileLoadFromClass |
|
228 |
'Load from Method' |
|
229 |
||
230 |
#fileLoadFromFile |
|
231 |
'Load from File.' |
|
232 |
||
233 |
#fileNewImage |
|
234 |
'New image' |
|
235 |
||
236 |
#filePrint |
|
237 |
'Print' |
|
238 |
||
239 |
#fileSaveAs |
|
240 |
'Save to file.' |
|
241 |
||
242 |
#fileSaveMaskAs |
|
243 |
'Save to file.' |
|
244 |
||
245 |
#fileSaveMethod |
|
246 |
'Save as method' |
|
247 |
||
248 |
#fileSaveMethodAs |
|
249 |
'Save as method' |
|
250 |
||
251 |
) |
|
252 |
! |
|
253 |
||
460 | 254 |
helpSpec |
737 | 255 |
"This resource specification was automatically generated |
256 |
by the UIHelpTool of ST/X." |
|
257 |
||
258 |
"Do not manually edit this!! If it is corrupted, |
|
259 |
the UIHelpTool may not be able to read the specification." |
|
460 | 260 |
|
261 |
" |
|
737 | 262 |
UIHelpTool openOnClass:ImageEditor |
460 | 263 |
" |
264 |
||
737 | 265 |
<resource: #help> |
266 |
||
267 |
^super helpSpec addPairsFrom:#( |
|
460 | 268 |
|
269 |
#colorMap |
|
929 | 270 |
'ColorMap functions.' |
271 |
||
272 |
#colorMap1 |
|
273 |
'Convert to depth-1 image.' |
|
274 |
||
986 | 275 |
#colorMap1M |
276 |
'Convert to depth-1 image plus mask.' |
|
277 |
||
929 | 278 |
#colorMap2 |
279 |
'Convert to depth-2 image.' |
|
280 |
||
986 | 281 |
#colorMap2M |
282 |
'Convert to depth-2 image plus mask.' |
|
283 |
||
929 | 284 |
#colorMap4 |
285 |
'Convert to depth-4 image.' |
|
286 |
||
986 | 287 |
#colorMap4M |
288 |
'Convert to depth-4 image plus mask.' |
|
289 |
||
929 | 290 |
#colorMap8 |
291 |
'Convert to depth-8 image.' |
|
292 |
||
293 |
#colorMap8M |
|
294 |
'Convert to depth-8 image plus mask.' |
|
295 |
||
986 | 296 |
#colorMapTable |
297 |
'Shows a list of used colors of the image.' |
|
298 |
||
929 | 299 |
#compressColormap |
300 |
'Remove unneeded entries from the colorMap.' |
|
460 | 301 |
|
1045 | 302 |
#cropAll |
986 | 303 |
'Find and remove all borders.' |
304 |
||
1045 | 305 |
#cropBottom |
986 | 306 |
'Find and remove bottom border.' |
307 |
||
1045 | 308 |
#cropLeft |
986 | 309 |
'Find and remove left border.' |
310 |
||
1045 | 311 |
#cropManual |
986 | 312 |
'Specify border(s) to remove.' |
313 |
||
1045 | 314 |
#cropRight |
986 | 315 |
'Find and remove right border.' |
316 |
||
1045 | 317 |
#cropTop |
986 | 318 |
'Find and remove top border.' |
487 | 319 |
|
460 | 320 |
#drawModeBox |
914 | 321 |
'Switches to box-drawing mode.' |
460 | 322 |
|
323 |
#drawModeCopy |
|
914 | 324 |
'Switches to area-copy mode.' |
460 | 325 |
|
326 |
#drawModeFill |
|
914 | 327 |
'Switches to flood-fill mode.' |
460 | 328 |
|
329 |
#drawModeFilledBox |
|
914 | 330 |
'Switches to filled-box drawing mode.' |
460 | 331 |
|
332 |
#drawModePaste |
|
914 | 333 |
'Switches to paste mode.' |
334 |
||
335 |
#drawModePasteUnder |
|
336 |
'Switches to paste under mode.' |
|
460 | 337 |
|
338 |
#drawModePoint |
|
914 | 339 |
'Switches to point-drawing mode.' |
460 | 340 |
|
341 |
#editFlipHorizontal |
|
914 | 342 |
'Flips the image horizontally.' |
460 | 343 |
|
344 |
#editFlipVertical |
|
914 | 345 |
'Flips the image vertically.' |
460 | 346 |
|
347 |
#editMagnifyImage |
|
914 | 348 |
'Magnify the image.' |
460 | 349 |
|
350 |
#editNegate |
|
914 | 351 |
'Invert the images colors.' |
460 | 352 |
|
353 |
#editResize |
|
914 | 354 |
'Resize the image (preserving the old image).' |
460 | 355 |
|
356 |
#editRotate |
|
914 | 357 |
'Rotate the image.' |
460 | 358 |
|
929 | 359 |
#fileGrabImage |
360 |
'Pick an image from the screen.' |
|
361 |
||
460 | 362 |
#fileLoadFromClass |
929 | 363 |
'Select and load an image from a resource method.' |
460 | 364 |
|
365 |
#fileLoadFromFile |
|
929 | 366 |
'Select and load an image from a file.' |
460 | 367 |
|
368 |
#fileNewImage |
|
914 | 369 |
'Create a new image' |
460 | 370 |
|
371 |
#filePrint |
|
372 |
'Print the image on a postscript printer.' |
|
373 |
||
374 |
#fileSaveAs |
|
914 | 375 |
'Save the image to a file.' |
460 | 376 |
|
377 |
#fileSaveMaskAs |
|
914 | 378 |
'Save the mask of the image to a file.' |
460 | 379 |
|
380 |
#fileSaveMethod |
|
914 | 381 |
'Save the image as resource method in the current class and selector.' |
460 | 382 |
|
383 |
#fileSaveMethodAs |
|
914 | 384 |
'Save the image as resource method in a class.' |
460 | 385 |
|
487 | 386 |
#magnificationNumber |
914 | 387 |
'Shows the current magnification.' |
487 | 388 |
|
389 |
#magnifyImageDown |
|
914 | 390 |
'Decrease magnification.' |
487 | 391 |
|
392 |
#magnifyImageUp |
|
914 | 393 |
'Increase magnification.' |
487 | 394 |
|
395 |
#mouseKeyColorMode |
|
914 | 396 |
'Toggles between left and right mouse button color.' |
487 | 397 |
|
398 |
#previewView |
|
914 | 399 |
'Shows a preview of the image.' |
487 | 400 |
|
905 | 401 |
#settingsGridMagnification |
914 | 402 |
'Change the grid magnification of the edit view.' |
905 | 403 |
|
460 | 404 |
) |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
405 |
|
986 | 406 |
"Modified: / 7.9.1998 / 18:20:26 / cg" |
460 | 407 |
! ! |
408 |
||
737 | 409 |
!ImageEditor class methodsFor:'image specs'! |
410 |
||
411 |
leftMouseKeyIcon |
|
412 |
"This resource specification was automatically generated |
|
413 |
by the ImageEditor of ST/X." |
|
414 |
||
415 |
"Do not manually edit this!! If it is corrupted, |
|
416 |
the ImageEditor may not be able to read the specification." |
|
417 |
||
418 |
" |
|
1405 | 419 |
self leftMouseKeyIcon inspect |
737 | 420 |
ImageEditor openOnClass:self andSelector:#leftMouseKeyIcon |
421 |
" |
|
422 |
||
423 |
<resource: #image> |
|
424 |
||
425 |
^Icon |
|
426 |
constantNamed:#'ImageEditor leftMouseKeyIcon' |
|
1433 | 427 |
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] |
428 |
! |
|
737 | 429 |
|
430 |
rightMouseKeyIcon |
|
431 |
"This resource specification was automatically generated |
|
432 |
by the ImageEditor of ST/X." |
|
433 |
||
434 |
"Do not manually edit this!! If it is corrupted, |
|
435 |
the ImageEditor may not be able to read the specification." |
|
436 |
||
437 |
" |
|
1405 | 438 |
self rightMouseKeyIcon inspect |
737 | 439 |
ImageEditor openOnClass:self andSelector:#rightMouseKeyIcon |
440 |
" |
|
441 |
||
442 |
<resource: #image> |
|
443 |
||
444 |
^Icon |
|
445 |
constantNamed:#'ImageEditor rightMouseKeyIcon' |
|
1433 | 446 |
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] |
447 |
! ! |
|
737 | 448 |
|
400 | 449 |
!ImageEditor class methodsFor:'interface specs'! |
450 |
||
767 | 451 |
dialogSpecForNewImage |
737 | 452 |
"This resource specification was automatically generated |
453 |
by the UIPainter of ST/X." |
|
519 | 454 |
|
737 | 455 |
"Do not manually edit this!! If it is corrupted, |
456 |
the UIPainter may not be able to read the specification." |
|
519 | 457 |
|
458 |
" |
|
767 | 459 |
UIPainter new openOnClass:ImageEditor andSelector:#dialogSpecForNewImage |
460 |
ImageEditor new openInterface:#dialogSpecForNewImage |
|
519 | 461 |
" |
462 |
||
463 |
<resource: #canvas> |
|
464 |
||
465 |
^ |
|
466 |
||
467 |
#(#FullSpec |
|
672 | 468 |
#window: |
519 | 469 |
#(#WindowSpec |
672 | 470 |
#name: 'New Image' |
975 | 471 |
#layout: #(#LayoutFrame 81 0 288 0 381 0 406 0) |
672 | 472 |
#label: 'New Image' |
473 |
#min: #(#Point 10 10) |
|
474 |
#max: #(#Point 1152 900) |
|
975 | 475 |
#bounds: #(#Rectangle 81 288 382 407) |
672 | 476 |
#usePreferredExtent: false |
519 | 477 |
) |
672 | 478 |
#component: |
519 | 479 |
#(#SpecCollection |
672 | 480 |
#collection: |
519 | 481 |
#( |
482 |
#(#ViewSpec |
|
672 | 483 |
#name: 'View' |
737 | 484 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -35 1.0) |
672 | 485 |
#component: |
519 | 486 |
#(#SpecCollection |
672 | 487 |
#collection: |
519 | 488 |
#( |
489 |
#(#FramedBoxSpec |
|
672 | 490 |
#name: 'framedBox1' |
932
7111238cda23
fixed dimension of new-image dialog.
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
491 |
#layout: #(#LayoutFrame 1 0.0 7 0.0 0 0.4 76 0) |
672 | 492 |
#component: |
519 | 493 |
#(#SpecCollection |
672 | 494 |
#collection: |
519 | 495 |
#( |
496 |
#(#ComboBoxSpec |
|
672 | 497 |
#name: 'defaultSizesComboBox' |
975 | 498 |
#layout: #(#LayoutFrame 0 0.0 10 0.0 0 1 35 0.0) |
672 | 499 |
#model: #selectionOfSize |
500 |
#type: #string |
|
501 |
#comboList: #listOfDefaultSizes |
|
519 | 502 |
) |
503 |
) |
|
504 |
) |
|
672 | 505 |
#label: 'Size' |
506 |
#labelPosition: #topLeft |
|
507 |
#style: #(#FontDescription #helvetica #medium #roman 12) |
|
519 | 508 |
) |
509 |
#(#FramedBoxSpec |
|
672 | 510 |
#name: 'framedBox2' |
932
7111238cda23
fixed dimension of new-image dialog.
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
511 |
#layout: #(#LayoutFrame 0 0.4 7 0.0 -1 1.0 76 0) |
672 | 512 |
#component: |
519 | 513 |
#(#SpecCollection |
672 | 514 |
#collection: |
519 | 515 |
#( |
516 |
#(#ComboListSpec |
|
672 | 517 |
#name: 'colorMapComboBox' |
975 | 518 |
#layout: #(#LayoutFrame 0 0.0 10 0.0 0 1 35 0.0) |
672 | 519 |
#model: #selectionOfColorMap |
520 |
#comboList: #listOfColorMaps |
|
521 |
#useIndex: false |
|
519 | 522 |
) |
523 |
) |
|
524 |
) |
|
672 | 525 |
#label: 'Color Map' |
526 |
#labelPosition: #topLeft |
|
527 |
#style: #(#FontDescription #helvetica #medium #roman 12) |
|
519 | 528 |
) |
529 |
) |
|
530 |
) |
|
672 | 531 |
#level: 1 |
519 | 532 |
) |
672 | 533 |
#(#UISubSpecification |
975 | 534 |
#name: 'windowSpecForCommitWithoutChannels' |
737 | 535 |
#layout: #(#LayoutFrame 2 0.0 -26 1 -2 1.0 -2 1.0) |
672 | 536 |
#minorKey: #windowSpecForCommitWithoutChannels |
519 | 537 |
) |
538 |
) |
|
539 |
) |
|
540 |
) |
|
767 | 541 |
! |
542 |
||
1045 | 543 |
gropDialogSpec |
986 | 544 |
"This resource specification was automatically generated |
545 |
by the UIPainter of ST/X." |
|
546 |
||
547 |
"Do not manually edit this!! If it is corrupted, |
|
548 |
the UIPainter may not be able to read the specification." |
|
549 |
||
550 |
" |
|
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
551 |
UIPainter new openOnClass:ImageEditor andSelector:#gropDialogSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
552 |
ImageEditor new openInterface:#gropDialogSpec |
986 | 553 |
" |
554 |
||
555 |
<resource: #canvas> |
|
556 |
||
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
557 |
^ |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
558 |
#(#FullSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
559 |
#name: #gropDialogSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
560 |
#window: |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
561 |
#(#WindowSpec |
1480 | 562 |
#label: 'Crop Border(s)' |
1490 | 563 |
#name: 'Crop Border(s)' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
564 |
#min: #(#Point 10 10) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
565 |
#max: #(#Point 800 478) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
566 |
#bounds: #(#Rectangle 16 46 261 229) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
567 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
568 |
#component: |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
569 |
#(#SpecCollection |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
570 |
#collection: #( |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
571 |
#(#LabelSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
572 |
#label: 'Left:' |
1502 | 573 |
#name: 'GropLeftLabel' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
574 |
#layout: #(#LayoutFrame 14 0 21 0 90 0 43 0) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
575 |
#translateLabel: true |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
576 |
#adjust: #right |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
577 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
578 |
#(#InputFieldSpec |
1502 | 579 |
#name: 'GropLeftEntryField' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
580 |
#layout: #(#LayoutFrame 95 0 21 0 132 0 43 0) |
1507 | 581 |
#tabable: true |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
582 |
#model: #left |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
583 |
#type: #number |
1502 | 584 |
#acceptChannel: #acceptChannel |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
585 |
#acceptOnPointerLeave: false |
1502 | 586 |
) |
587 |
#(#ActionButtonSpec |
|
588 |
#label: 'Now' |
|
589 |
#name: 'GropLeftNowButton' |
|
590 |
#layout: #(#LayoutFrame 148 0 21 0 221 0 43 0) |
|
591 |
#translateLabel: true |
|
1507 | 592 |
#tabable: true |
1502 | 593 |
#model: #gropLeftNow |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
594 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
595 |
#(#LabelSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
596 |
#label: 'Right:' |
1502 | 597 |
#name: 'GropRightLabel' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
598 |
#layout: #(#LayoutFrame 14 0 51 0 90 0 73 0) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
599 |
#translateLabel: true |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
600 |
#adjust: #right |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
601 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
602 |
#(#InputFieldSpec |
1502 | 603 |
#name: 'GropRightEntryField' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
604 |
#layout: #(#LayoutFrame 95 0 51 0 132 0 73 0) |
1507 | 605 |
#tabable: true |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
606 |
#model: #right |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
607 |
#type: #number |
1502 | 608 |
#acceptChannel: #acceptChannel |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
609 |
#acceptOnPointerLeave: false |
1502 | 610 |
) |
611 |
#(#ActionButtonSpec |
|
612 |
#label: 'Now' |
|
613 |
#name: 'GropRightButton' |
|
614 |
#layout: #(#LayoutFrame 148 0 51 0 221 0 73 0) |
|
615 |
#translateLabel: true |
|
1507 | 616 |
#tabable: true |
1502 | 617 |
#model: #gropRightNow |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
618 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
619 |
#(#LabelSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
620 |
#label: 'Top:' |
1502 | 621 |
#name: 'GropTopLabel' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
622 |
#layout: #(#LayoutFrame 14 0 81 0 90 0 103 0) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
623 |
#translateLabel: true |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
624 |
#adjust: #right |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
625 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
626 |
#(#InputFieldSpec |
1502 | 627 |
#name: 'GropTopEntryField' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
628 |
#layout: #(#LayoutFrame 95 0 81 0 132 0 103 0) |
1507 | 629 |
#tabable: true |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
630 |
#model: #top |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
631 |
#type: #number |
1502 | 632 |
#acceptChannel: #acceptChannel |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
633 |
#acceptOnPointerLeave: false |
1502 | 634 |
) |
635 |
#(#ActionButtonSpec |
|
636 |
#label: 'Now' |
|
637 |
#name: 'GropTopButton' |
|
638 |
#layout: #(#LayoutFrame 148 0 81 0 221 0 103 0) |
|
639 |
#translateLabel: true |
|
1507 | 640 |
#tabable: true |
1502 | 641 |
#model: #gropTopNow |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
642 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
643 |
#(#LabelSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
644 |
#label: 'Bottom:' |
1502 | 645 |
#name: 'GropBottomLabel' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
646 |
#layout: #(#LayoutFrame 14 0 111 0 90 0 133 0) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
647 |
#translateLabel: true |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
648 |
#adjust: #right |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
649 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
650 |
#(#InputFieldSpec |
1502 | 651 |
#name: 'GropBottomEntryField' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
652 |
#layout: #(#LayoutFrame 95 0 111 0 132 0 133 0) |
1507 | 653 |
#tabable: true |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
654 |
#model: #bottom |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
655 |
#type: #number |
1502 | 656 |
#acceptChannel: #acceptChannel |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
657 |
#acceptOnPointerLeave: false |
1502 | 658 |
) |
659 |
#(#ActionButtonSpec |
|
660 |
#label: 'Now' |
|
661 |
#name: 'GropBottomButton' |
|
662 |
#layout: #(#LayoutFrame 148 0 111 0 221 0 133 0) |
|
663 |
#translateLabel: true |
|
1507 | 664 |
#tabable: true |
1502 | 665 |
#model: #gropBottomNow |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
666 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
667 |
#(#HorizontalPanelViewSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
668 |
#name: 'HorizontalPanel1' |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
669 |
#layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
670 |
#horizontalLayout: #fitSpace |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
671 |
#verticalLayout: #center |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
672 |
#horizontalSpace: 3 |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
673 |
#verticalSpace: 3 |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
674 |
#reverseOrderIfOKAtLeft: true |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
675 |
#component: |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
676 |
#(#SpecCollection |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
677 |
#collection: #( |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
678 |
#(#ActionButtonSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
679 |
#label: 'Cancel' |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
680 |
#name: 'Button1' |
986 | 681 |
#translateLabel: true |
1507 | 682 |
#tabable: true |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
683 |
#model: #cancel |
1490 | 684 |
#extent: #(#Point 77 22) |
685 |
) |
|
686 |
#(#ActionButtonSpec |
|
687 |
#label: 'Apply' |
|
688 |
#name: 'Button3' |
|
689 |
#translateLabel: true |
|
1507 | 690 |
#tabable: true |
1490 | 691 |
#model: #applyAction |
692 |
#extent: #(#Point 78 22) |
|
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
693 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
694 |
#(#ActionButtonSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
695 |
#label: 'OK' |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
696 |
#name: 'Button2' |
986 | 697 |
#translateLabel: true |
1507 | 698 |
#tabable: true |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
699 |
#model: #accept |
1490 | 700 |
#extent: #(#Point 78 22) |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
701 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
702 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
703 |
|
986 | 704 |
) |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
705 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
706 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
707 |
|
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
708 |
) |
986 | 709 |
) |
710 |
! |
|
711 |
||
1557 | 712 |
shiftDialogSpec |
713 |
"This resource specification was automatically generated |
|
714 |
by the UIPainter of ST/X." |
|
715 |
||
716 |
"Do not manually edit this!! If it is corrupted, |
|
717 |
the UIPainter may not be able to read the specification." |
|
718 |
||
719 |
" |
|
720 |
UIPainter new openOnClass:ImageEditor andSelector:#shiftDialogSpec |
|
721 |
ImageEditor new openInterface:#shiftDialogSpec |
|
722 |
" |
|
723 |
||
724 |
<resource: #canvas> |
|
725 |
||
726 |
^ |
|
727 |
#(#FullSpec |
|
728 |
#name: #shiftDialogSpec |
|
729 |
#window: |
|
730 |
#(#WindowSpec |
|
731 |
#label: 'Shift' |
|
732 |
#name: 'Shift' |
|
733 |
#min: #(#Point 10 10) |
|
734 |
#max: #(#Point 800 478) |
|
735 |
#bounds: #(#Rectangle 16 46 261 229) |
|
736 |
) |
|
737 |
#component: |
|
738 |
#(#SpecCollection |
|
739 |
#collection: #( |
|
740 |
#(#LabelSpec |
|
741 |
#label: 'Amount:' |
|
742 |
#name: 'AmountLabel' |
|
743 |
#layout: #(#LayoutFrame 14 0 21 0 90 0 43 0) |
|
744 |
#translateLabel: true |
|
745 |
#adjust: #right |
|
746 |
) |
|
747 |
#(#InputFieldSpec |
|
748 |
#name: 'AmountEntryField' |
|
749 |
#layout: #(#LayoutFrame 95 0 21 0 132 0 43 0) |
|
750 |
#tabable: true |
|
751 |
#model: #shiftAmount |
|
752 |
#type: #number |
|
753 |
#acceptChannel: #acceptChannel |
|
754 |
#acceptOnPointerLeave: false |
|
755 |
) |
|
756 |
#(#HorizontalPanelViewSpec |
|
757 |
#name: 'HorizontalPanel1' |
|
758 |
#layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1) |
|
759 |
#horizontalLayout: #fitSpace |
|
760 |
#verticalLayout: #center |
|
761 |
#horizontalSpace: 3 |
|
762 |
#verticalSpace: 3 |
|
763 |
#reverseOrderIfOKAtLeft: true |
|
764 |
#component: |
|
765 |
#(#SpecCollection |
|
766 |
#collection: #( |
|
767 |
#(#ActionButtonSpec |
|
768 |
#label: 'Cancel' |
|
769 |
#name: 'Button1' |
|
770 |
#translateLabel: true |
|
771 |
#tabable: true |
|
772 |
#model: #cancel |
|
773 |
#extent: #(#Point 118 22) |
|
774 |
) |
|
775 |
#(#ActionButtonSpec |
|
776 |
#label: 'OK' |
|
777 |
#name: 'Button2' |
|
778 |
#translateLabel: true |
|
779 |
#tabable: true |
|
780 |
#model: #accept |
|
781 |
#extent: #(#Point 118 22) |
|
782 |
) |
|
783 |
) |
|
784 |
||
785 |
) |
|
786 |
) |
|
787 |
#(#ArrowButtonSpec |
|
788 |
#name: 'ArrowButton1' |
|
789 |
#layout: #(#LayoutFrame 105 0 67 0 127 0 89 0) |
|
790 |
#model: #shiftUpNow |
|
791 |
#isTriggerOnDown: true |
|
792 |
#actionValue: '' |
|
793 |
#direction: #up |
|
794 |
) |
|
795 |
#(#ArrowButtonSpec |
|
796 |
#name: 'ArrowButton2' |
|
797 |
#layout: #(#LayoutFrame 88 0 86 0 110 0 108 0) |
|
798 |
#model: #shiftLeftNow |
|
799 |
#isTriggerOnDown: true |
|
800 |
#actionValue: '' |
|
801 |
#direction: #left |
|
802 |
) |
|
803 |
#(#ArrowButtonSpec |
|
804 |
#name: 'ArrowButton3' |
|
805 |
#layout: #(#LayoutFrame 122 0 86 0 144 0 108 0) |
|
806 |
#model: #shiftRightNow |
|
807 |
#isTriggerOnDown: true |
|
808 |
#actionValue: '' |
|
809 |
#direction: #right |
|
810 |
) |
|
811 |
#(#ArrowButtonSpec |
|
812 |
#name: 'ArrowButton4' |
|
813 |
#layout: #(#LayoutFrame 105 0 103 0 127 0 125 0) |
|
814 |
#model: #shiftDownNow |
|
815 |
#isTriggerOnDown: true |
|
816 |
#actionValue: '' |
|
817 |
#direction: #down |
|
818 |
) |
|
819 |
) |
|
820 |
||
821 |
) |
|
822 |
) |
|
823 |
! |
|
824 |
||
1480 | 825 |
ungropDialogSpec |
826 |
"This resource specification was automatically generated |
|
827 |
by the UIPainter of ST/X." |
|
828 |
||
829 |
"Do not manually edit this!! If it is corrupted, |
|
830 |
the UIPainter may not be able to read the specification." |
|
831 |
||
832 |
" |
|
833 |
UIPainter new openOnClass:ImageEditor andSelector:#ungropDialogSpec |
|
834 |
ImageEditor new openInterface:#ungropDialogSpec |
|
835 |
" |
|
836 |
||
837 |
<resource: #canvas> |
|
838 |
||
839 |
^ |
|
840 |
#(#FullSpec |
|
841 |
#name: #ungropDialogSpec |
|
842 |
#window: |
|
843 |
#(#WindowSpec |
|
844 |
#label: 'Add Border(s)' |
|
845 |
#name: 'Add Borders' |
|
846 |
#min: #(#Point 10 10) |
|
847 |
#max: #(#Point 800 478) |
|
848 |
#bounds: #(#Rectangle 16 46 261 229) |
|
849 |
) |
|
850 |
#component: |
|
851 |
#(#SpecCollection |
|
852 |
#collection: #( |
|
853 |
#(#LabelSpec |
|
854 |
#label: 'Left:' |
|
855 |
#name: 'Label1' |
|
856 |
#layout: #(#LayoutFrame 14 0 21 0 90 0 43 0) |
|
857 |
#translateLabel: true |
|
858 |
#adjust: #right |
|
859 |
) |
|
860 |
#(#InputFieldSpec |
|
861 |
#name: 'EntryField1' |
|
862 |
#layout: #(#LayoutFrame 95 0 21 0 132 0 43 0) |
|
863 |
#model: #left |
|
864 |
#type: #number |
|
865 |
#acceptOnPointerLeave: false |
|
866 |
) |
|
867 |
#(#LabelSpec |
|
868 |
#label: 'Right:' |
|
869 |
#name: 'Label2' |
|
870 |
#layout: #(#LayoutFrame 14 0 51 0 90 0 73 0) |
|
871 |
#translateLabel: true |
|
872 |
#adjust: #right |
|
873 |
) |
|
874 |
#(#InputFieldSpec |
|
875 |
#name: 'EntryField2' |
|
876 |
#layout: #(#LayoutFrame 95 0 51 0 132 0 73 0) |
|
877 |
#model: #right |
|
878 |
#type: #number |
|
879 |
#acceptOnPointerLeave: false |
|
880 |
) |
|
881 |
#(#LabelSpec |
|
882 |
#label: 'Top:' |
|
883 |
#name: 'Label3' |
|
884 |
#layout: #(#LayoutFrame 14 0 81 0 90 0 103 0) |
|
885 |
#translateLabel: true |
|
886 |
#adjust: #right |
|
887 |
) |
|
888 |
#(#InputFieldSpec |
|
889 |
#name: 'EntryField3' |
|
890 |
#layout: #(#LayoutFrame 95 0 81 0 132 0 103 0) |
|
891 |
#model: #top |
|
892 |
#type: #number |
|
893 |
#acceptOnPointerLeave: false |
|
894 |
) |
|
895 |
#(#LabelSpec |
|
896 |
#label: 'Bottom:' |
|
897 |
#name: 'Label4' |
|
898 |
#layout: #(#LayoutFrame 14 0 111 0 90 0 133 0) |
|
899 |
#translateLabel: true |
|
900 |
#adjust: #right |
|
901 |
) |
|
902 |
#(#InputFieldSpec |
|
903 |
#name: 'EntryField4' |
|
904 |
#layout: #(#LayoutFrame 95 0 111 0 132 0 133 0) |
|
905 |
#model: #bottom |
|
906 |
#type: #number |
|
907 |
#acceptOnPointerLeave: false |
|
908 |
) |
|
909 |
#(#HorizontalPanelViewSpec |
|
910 |
#name: 'HorizontalPanel1' |
|
911 |
#layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1) |
|
912 |
#horizontalLayout: #fitSpace |
|
913 |
#verticalLayout: #center |
|
914 |
#horizontalSpace: 3 |
|
915 |
#verticalSpace: 3 |
|
916 |
#reverseOrderIfOKAtLeft: true |
|
917 |
#component: |
|
918 |
#(#SpecCollection |
|
919 |
#collection: #( |
|
920 |
#(#ActionButtonSpec |
|
921 |
#label: 'Cancel' |
|
922 |
#name: 'Button1' |
|
923 |
#translateLabel: true |
|
924 |
#model: #cancel |
|
925 |
#extent: #(#Point 118 22) |
|
926 |
) |
|
927 |
#(#ActionButtonSpec |
|
928 |
#label: 'OK' |
|
929 |
#name: 'Button2' |
|
930 |
#translateLabel: true |
|
931 |
#model: #accept |
|
932 |
#extent: #(#Point 118 22) |
|
933 |
) |
|
934 |
) |
|
935 |
||
936 |
) |
|
937 |
) |
|
938 |
) |
|
939 |
||
940 |
) |
|
941 |
) |
|
942 |
! |
|
943 |
||
767 | 944 |
windowSpec |
945 |
"This resource specification was automatically generated |
|
946 |
by the UIPainter of ST/X." |
|
947 |
||
948 |
"Do not manually edit this!! If it is corrupted, |
|
949 |
the UIPainter may not be able to read the specification." |
|
950 |
||
951 |
" |
|
952 |
UIPainter new openOnClass:ImageEditor andSelector:#windowSpec |
|
953 |
ImageEditor new openInterface:#windowSpec |
|
954 |
ImageEditor open |
|
955 |
" |
|
956 |
||
957 |
<resource: #canvas> |
|
958 |
||
959 |
^ |
|
960 |
||
961 |
#(#FullSpec |
|
962 |
#window: |
|
963 |
#(#WindowSpec |
|
964 |
#name: 'Image Editor' |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
965 |
#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
|
966 |
#level: 0 |
767 | 967 |
#label: 'Image Editor' |
968 |
#min: #(#Point 400 320) |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
969 |
#bounds: #(#Rectangle 507 28 1005 372) |
767 | 970 |
#menu: #menu |
971 |
#usePreferredExtent: false |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
972 |
#returnIsOKInDialog: true |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
973 |
#escapeIsCancelInDialog: true |
767 | 974 |
) |
975 |
#component: |
|
976 |
#(#SpecCollection |
|
977 |
#collection: |
|
978 |
#( |
|
979 |
#(#MenuPanelSpec |
|
980 |
#name: 'menuToolbarView' |
|
981 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
982 |
#menu: #menuToolbar |
|
983 |
#style: #(#FontDescription #helvetica #medium #roman 10) |
|
984 |
#showSeparatingLines: true |
|
985 |
) |
|
986 |
#(#VariableHorizontalPanelSpec |
|
987 |
#name: 'variableHorizontalPanel1' |
|
988 |
#layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0) |
|
989 |
#component: |
|
990 |
#(#SpecCollection |
|
991 |
#collection: |
|
992 |
#( |
|
993 |
#(#ViewSpec |
|
994 |
#name: 'view1' |
|
995 |
#component: |
|
996 |
#(#SpecCollection |
|
997 |
#collection: |
|
998 |
#( |
|
999 |
#(#VariableVerticalPanelSpec |
|
1000 |
#name: 'VariableVerticalPanel1' |
|
1001 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
1002 |
#component: |
|
1003 |
#(#SpecCollection |
|
1004 |
#collection: |
|
1005 |
#( |
|
1006 |
#(#ViewSpec |
|
1007 |
#name: 'View1' |
|
1008 |
#component: |
|
1009 |
#(#SpecCollection |
|
1010 |
#collection: |
|
1011 |
#( |
|
1012 |
#(#MenuPanelSpec |
|
1013 |
#name: 'MouseButtonColorToolBar' |
|
1014 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 24 0) |
|
1015 |
#menu: #menuMouseButtonColors |
|
1016 |
) |
|
1017 |
#(#DataSetSpec |
|
1018 |
#name: 'colorDataSetView' |
|
1019 |
#layout: #(#LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0) |
|
1020 |
#activeHelpKey: #colorMapTable |
|
1021 |
#model: #selectionOfColor |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1022 |
#menu: #colorMapMenu |
767 | 1023 |
#style: #(#FontDescription #helvetica #medium #roman 10) |
1024 |
#hasHorizontalScrollBar: true |
|
1025 |
#hasVerticalScrollBar: true |
|
1026 |
#miniScrollerHorizontal: true |
|
1027 |
#miniScrollerVertical: true |
|
1028 |
#dataList: #listOfColors |
|
1029 |
#has3Dsepartors: true |
|
905 | 1030 |
#has3Dseparators: true |
767 | 1031 |
#verticalSpacing: 1 |
1032 |
#columns: |
|
1033 |
#( |
|
1034 |
#(#DataSetColumnSpec |
|
1035 |
#rendererType: #rowSelector |
|
1449
49ad9f552d64
oops - fixed bg-color access in dataset
Claus Gittinger <cg@exept.de>
parents:
1446
diff
changeset
|
1036 |
#backgroundSelector: #theColorItSelf: |
767 | 1037 |
) |
1038 |
#(#DataSetColumnSpec |
|
1039 |
#label: 'R' |
|
1040 |
#labelAlignment: #left |
|
942 | 1041 |
#columnAlignment: #right |
1042 |
#editorType: #InputField |
|
1043 |
#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
|
1044 |
#model: #redFromColor: |
942 | 1045 |
#writeSelector: #redAtColor:put: |
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1046 |
#selectSelector: #canSelectRedInColor: |
767 | 1047 |
) |
1048 |
#(#DataSetColumnSpec |
|
1049 |
#label: 'G' |
|
1050 |
#labelAlignment: #left |
|
942 | 1051 |
#columnAlignment: #right |
1052 |
#editorType: #InputField |
|
1053 |
#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
|
1054 |
#model: #greenFromColor: |
942 | 1055 |
#writeSelector: #greenAtColor:put: |
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1056 |
#selectSelector: #canSelectGreenInColor: |
767 | 1057 |
) |
1058 |
#(#DataSetColumnSpec |
|
1059 |
#label: 'B' |
|
1060 |
#labelAlignment: #left |
|
942 | 1061 |
#columnAlignment: #right |
1062 |
#editorType: #InputField |
|
1063 |
#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
|
1064 |
#model: #blueFromColor: |
942 | 1065 |
#writeSelector: #blueAtColor:put: |
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1066 |
#selectSelector: #canSelectBlueInColor: |
767 | 1067 |
) |
1068 |
) |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1069 |
#columnAdaptor: #colorColumnAdaptor |
767 | 1070 |
) |
1071 |
) |
|
1072 |
) |
|
1073 |
) |
|
1074 |
#(#ArbitraryComponentSpec |
|
1075 |
#name: 'imagePreView' |
|
1076 |
#activeHelpKey: #previewView |
|
1077 |
#hasHorizontalScrollBar: true |
|
1078 |
#hasVerticalScrollBar: true |
|
1079 |
#miniScrollerHorizontal: true |
|
1080 |
#miniScrollerVertical: true |
|
1081 |
#component: #ImageView |
|
1082 |
#hasBorder: false |
|
1083 |
) |
|
1084 |
) |
|
1085 |
) |
|
1086 |
#handles: #(#Any 0.723776 1.0) |
|
1087 |
) |
|
1088 |
) |
|
1089 |
) |
|
1090 |
) |
|
1091 |
#(#ViewSpec |
|
1092 |
#name: 'view2' |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1093 |
#level: -1 |
767 | 1094 |
#component: |
1095 |
#(#SpecCollection |
|
1096 |
#collection: |
|
1097 |
#( |
|
1098 |
#(#ArbitraryComponentSpec |
|
1099 |
#name: 'imageEditView' |
|
1100 |
#layout: #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0) |
|
1101 |
#hasHorizontalScrollBar: true |
|
1102 |
#hasVerticalScrollBar: true |
|
1103 |
#component: #ImageEditView |
|
1104 |
#hasBorder: false |
|
1105 |
) |
|
1106 |
#(#LabelSpec |
|
1107 |
#name: 'coordLabel' |
|
1108 |
#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
|
1109 |
#level: -1 |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1110 |
#labelChannel: #imageInfoHolder |
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1111 |
#resizeForLabel: false |
767 | 1112 |
#adjust: #left |
1113 |
) |
|
1114 |
#(#ArrowButtonSpec |
|
1115 |
#name: 'magnifyDownButton' |
|
1116 |
#layout: #(#LayoutFrame -80 1 -22 1 -58 1 0 1) |
|
1117 |
#activeHelpKey: #magnifyImageDown |
|
1118 |
#model: #doMagnifyDown |
|
1119 |
#enableChannel: #imageIsLoaded |
|
1120 |
#isTriggerOnDown: true |
|
1121 |
#direction: #left |
|
1122 |
) |
|
1123 |
#(#ArrowButtonSpec |
|
1124 |
#name: 'magnifyUpButton' |
|
1125 |
#layout: #(#LayoutFrame -24 1 -22 1 -2 1 0 1) |
|
1126 |
#activeHelpKey: #magnifyImageUp |
|
1127 |
#model: #doMagnifyUp |
|
1128 |
#enableChannel: #imageIsLoaded |
|
1129 |
#isTriggerOnDown: true |
|
1130 |
#direction: #right |
|
1131 |
) |
|
1132 |
#(#InputFieldSpec |
|
1133 |
#name: 'magnificationInputField' |
|
1134 |
#layout: #(#LayoutFrame -57 1 -22 1 -26 1 0 1) |
|
1135 |
#activeHelpKey: #magnificationNumber |
|
1136 |
#enableChannel: #imageIsLoaded |
|
1137 |
#model: #valueOfMagnification |
|
905 | 1138 |
#type: #numberInRange |
767 | 1139 |
#acceptOnReturn: false |
1140 |
#acceptOnTab: false |
|
1141 |
#numChars: 2 |
|
905 | 1142 |
#minValue: 1 |
1143 |
#maxValue: 99 |
|
767 | 1144 |
) |
1145 |
) |
|
1146 |
) |
|
1147 |
) |
|
1148 |
) |
|
1149 |
) |
|
1150 |
#handles: #(#Any 0.276 1.0) |
|
1151 |
) |
|
1152 |
#(#UISubSpecification |
|
1153 |
#name: 'infoBarSubSpec' |
|
1154 |
#layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) |
|
1155 |
#majorKey: #ToolApplicationModel |
|
1156 |
#minorKey: #windowSpecForInfoBar |
|
1157 |
) |
|
1158 |
) |
|
1159 |
) |
|
1160 |
) |
|
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
1161 |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1162 |
"Modified: / 12.3.1999 / 00:15:05 / cg" |
519 | 1163 |
! ! |
1164 |
||
1165 |
!ImageEditor class methodsFor:'menu specs'! |
|
1166 |
||
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1167 |
colorMapMenu |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1168 |
"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
|
1169 |
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
|
1170 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1171 |
"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
|
1172 |
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
|
1173 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1174 |
" |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1175 |
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
|
1176 |
(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
|
1177 |
" |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1178 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1179 |
<resource: #menu> |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1180 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1181 |
^ |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1182 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1183 |
#(#Menu |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1184 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1185 |
#( |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1186 |
#(#MenuItem |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1187 |
#label: 'Add Color' |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1188 |
#translateLabel: true |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1189 |
#value: #addColorToColormap |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1190 |
) |
1544 | 1191 |
#(#MenuItem |
1192 |
#label: '-' |
|
1193 |
) |
|
1194 |
#(#MenuItem |
|
1195 |
#label: 'Inspect Color' |
|
1196 |
#translateLabel: true |
|
1197 |
#value: #inspectColor |
|
1198 |
) |
|
1446 | 1199 |
"/ #(#MenuItem |
1200 |
"/ #label: 'Make Brighter' |
|
1201 |
"/ #translateLabel: true |
|
1202 |
"/ #value: #makeSelectedColorBrighter |
|
1203 |
"/ ) |
|
1204 |
"/ #(#MenuItem |
|
1205 |
"/ #label: 'Make Darker' |
|
1206 |
"/ #translateLabel: true |
|
1207 |
"/ #value: #makeSelectedColorDarker |
|
1208 |
"/ ) |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1209 |
) nil |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1210 |
nil |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1211 |
) |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1212 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1213 |
"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
|
1214 |
! |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1215 |
|
400 | 1216 |
menu |
737 | 1217 |
"This resource specification was automatically generated |
1218 |
by the MenuEditor of ST/X." |
|
400 | 1219 |
|
737 | 1220 |
"Do not manually edit this!! If it is corrupted, |
1221 |
the MenuEditor may not be able to read the specification." |
|
400 | 1222 |
|
1223 |
" |
|
1224 |
MenuEditor new openOnClass:ImageEditor andSelector:#menu |
|
1225 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menu)) startUp |
|
1226 |
" |
|
1227 |
||
1228 |
<resource: #menu> |
|
1229 |
||
1124 | 1230 |
^ |
1231 |
#(#Menu |
|
1232 |
#( |
|
1233 |
#(#MenuItem |
|
1489 | 1234 |
#label: '&File' |
1124 | 1235 |
#translateLabel: true |
1236 |
#activeHelpKey: #file |
|
1489 | 1237 |
#shortcutKeyCharacter: #Cmdf |
1124 | 1238 |
#submenu: |
1239 |
#(#Menu |
|
1240 |
#( |
|
1241 |
#(#MenuItem |
|
1242 |
#label: 'New...' |
|
1243 |
#translateLabel: true |
|
1244 |
#value: #doNewImage |
|
1245 |
#activeHelpKey: #fileNewImage |
|
1246 |
) |
|
1247 |
#(#MenuItem |
|
1248 |
#label: '-' |
|
1249 |
) |
|
1250 |
#(#MenuItem |
|
1251 |
#label: 'Load...' |
|
1252 |
#translateLabel: true |
|
1253 |
#value: #doLoadFromClass |
|
1254 |
#activeHelpKey: #fileLoadFromClass |
|
1255 |
) |
|
1256 |
#(#MenuItem |
|
1257 |
#label: 'Load From File...' |
|
1258 |
#translateLabel: true |
|
1259 |
#value: #doLoadFromFile |
|
1260 |
#activeHelpKey: #fileLoadFromFile |
|
1261 |
) |
|
1262 |
#(#MenuItem |
|
1263 |
#label: 'Grab From Screen' |
|
1264 |
#translateLabel: true |
|
1265 |
#value: #grabScreenImage |
|
1266 |
#activeHelpKey: #fileGrabImage |
|
1267 |
) |
|
1268 |
#(#MenuItem |
|
1496 | 1269 |
#label: 'Next in Sequence' |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1270 |
#translateLabel: true |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1271 |
#value: #nextImageInSequence |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1272 |
#enabled: #imageHasNextImage |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1273 |
) |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1274 |
#(#MenuItem |
1124 | 1275 |
#label: '-' |
1276 |
) |
|
1277 |
#(#MenuItem |
|
1278 |
#label: 'Save' |
|
1279 |
#translateLabel: true |
|
1280 |
#value: #doSaveMethod |
|
1281 |
#activeHelpKey: #fileSaveMethod |
|
1282 |
#enabled: #imageIsLoadedAndClassDefined |
|
1283 |
) |
|
1284 |
#(#MenuItem |
|
1285 |
#label: 'Save As...' |
|
1286 |
#translateLabel: true |
|
1287 |
#value: #doSaveMethodAs |
|
1288 |
#activeHelpKey: #fileSaveMethodAs |
|
1289 |
#enabled: #imageIsLoaded |
|
1290 |
) |
|
1291 |
#(#MenuItem |
|
1292 |
#label: '-' |
|
1293 |
) |
|
1294 |
#(#MenuItem |
|
1295 |
#label: 'Save To File...' |
|
1296 |
#translateLabel: true |
|
1297 |
#value: #doSaveImageFileAs |
|
1298 |
#activeHelpKey: #fileSaveAs |
|
1299 |
#enabled: #imageIsLoaded |
|
1300 |
) |
|
1301 |
#(#MenuItem |
|
1302 |
#label: 'Save Mask To File...' |
|
1303 |
#translateLabel: true |
|
1304 |
#value: #doSaveImageMaskFileAs |
|
1305 |
#activeHelpKey: #fileSaveMaskAs |
|
1306 |
#enabled: #imageIsLoaded |
|
1307 |
) |
|
1308 |
#(#MenuItem |
|
1309 |
#label: '-' |
|
1310 |
) |
|
1311 |
#(#MenuItem |
|
1309
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1312 |
#label: 'Show storeString' |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1313 |
#translateLabel: true |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1314 |
#value: #doShowStoreString |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1315 |
#activeHelpKey: #fileShowStoreString |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1316 |
#enabled: #imageIsLoaded |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1317 |
) |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1318 |
#(#MenuItem |
1433 | 1319 |
#label: 'Edit Mask' |
1320 |
#translateLabel: true |
|
1321 |
#value: #doEditMask |
|
1322 |
#activeHelpKey: #fileEditMask |
|
1323 |
#enabled: #imageIsLoaded |
|
1324 |
) |
|
1325 |
#(#MenuItem |
|
1309
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1326 |
#label: '-' |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1327 |
) |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1328 |
#(#MenuItem |
1124 | 1329 |
#label: 'Print' |
1330 |
#translateLabel: true |
|
1331 |
#value: #doPrint |
|
1332 |
#activeHelpKey: #filePrint |
|
1333 |
#enabled: #imageIsLoaded |
|
1334 |
) |
|
1335 |
#(#MenuItem |
|
1336 |
#label: '-' |
|
1337 |
) |
|
1338 |
#(#MenuItem |
|
1339 |
#label: 'Browse Class' |
|
1340 |
#translateLabel: true |
|
1341 |
#value: #doBrowseClass |
|
1342 |
#activeHelpKey: #fileBrowseClass |
|
1343 |
#enabled: #hasClassDefined |
|
1344 |
) |
|
1345 |
#(#MenuItem |
|
1346 |
#label: '-' |
|
1347 |
) |
|
1348 |
#(#MenuItem |
|
1349 |
#label: 'Exit' |
|
1350 |
#translateLabel: true |
|
1351 |
#value: #closeRequest |
|
1352 |
#activeHelpKey: #fileExit |
|
1353 |
) |
|
1354 |
) |
|
1355 |
nil |
|
1356 |
nil |
|
400 | 1357 |
) |
1124 | 1358 |
) |
1359 |
#(#MenuItem |
|
1360 |
#label: 'Edit' |
|
1361 |
#translateLabel: true |
|
1362 |
#activeHelpKey: #edit |
|
1363 |
#enabled: #imageIsLoaded |
|
1364 |
#submenu: |
|
1365 |
#(#Menu |
|
1366 |
#( |
|
1367 |
#(#MenuItem |
|
1368 |
#label: 'Undo' |
|
1369 |
#translateLabel: true |
|
1370 |
#value: #doUndo |
|
1371 |
#activeHelpKey: #editUndo |
|
1372 |
#enabled: #valueOfCanUndo |
|
1373 |
) |
|
1374 |
#(#MenuItem |
|
1375 |
#label: '-' |
|
1376 |
) |
|
1377 |
#(#MenuItem |
|
1378 |
#label: 'Flip - Vertical' |
|
1379 |
#translateLabel: true |
|
1380 |
#value: #doFlipVertical |
|
1381 |
#activeHelpKey: #editFlipVertical |
|
1382 |
) |
|
1383 |
#(#MenuItem |
|
1384 |
#label: 'Flip - Horizontal' |
|
1385 |
#translateLabel: true |
|
1386 |
#value: #doFlipHorizontal |
|
1387 |
#activeHelpKey: #editFlipHorizontal |
|
1388 |
) |
|
1389 |
#(#MenuItem |
|
1390 |
#label: '-' |
|
1391 |
) |
|
1392 |
#(#MenuItem |
|
1393 |
#label: 'Resize...' |
|
1394 |
#translateLabel: true |
|
1395 |
#value: #doResizeImage |
|
1396 |
#activeHelpKey: #editResize |
|
1397 |
) |
|
1398 |
#(#MenuItem |
|
1399 |
#label: 'Magnify...' |
|
1400 |
#translateLabel: true |
|
1401 |
#value: #doMagnifyImage |
|
1402 |
#activeHelpKey: #editMagnifyImage |
|
1403 |
) |
|
1404 |
#(#MenuItem |
|
1479 | 1405 |
#label: 'Magnify By...' |
1406 |
#translateLabel: true |
|
1407 |
#value: #doMagnifyImageBy |
|
1408 |
#activeHelpKey: #editMagnifyImage |
|
1409 |
) |
|
1410 |
#(#MenuItem |
|
1124 | 1411 |
#label: 'Rotate...' |
1412 |
#translateLabel: true |
|
1413 |
#value: #doRotateImage |
|
1414 |
#activeHelpKey: #editRotate |
|
1415 |
) |
|
1416 |
#(#MenuItem |
|
1417 |
#label: '-' |
|
1418 |
) |
|
1419 |
#(#MenuItem |
|
1146 | 1420 |
#label: 'Invert' |
1421 |
#translateLabel: true |
|
1422 |
#value: #doNegativeImage |
|
1423 |
) |
|
1424 |
#(#MenuItem |
|
1425 |
#label: '-' |
|
1426 |
) |
|
1427 |
#(#MenuItem |
|
1124 | 1428 |
#label: 'Crop' |
1429 |
#translateLabel: true |
|
1430 |
#submenu: |
|
400 | 1431 |
#(#Menu |
1124 | 1432 |
#( |
1433 |
#(#MenuItem |
|
1434 |
#label: 'All' |
|
1435 |
#translateLabel: true |
|
1436 |
#value: #doCropAll |
|
1437 |
#activeHelpKey: #cropAll |
|
400 | 1438 |
) |
1124 | 1439 |
#(#MenuItem |
1440 |
#label: '-' |
|
986 | 1441 |
) |
1124 | 1442 |
#(#MenuItem |
1443 |
#label: 'Left' |
|
1444 |
#translateLabel: true |
|
1445 |
#value: #doCropLeft |
|
1446 |
#activeHelpKey: #cropLeft |
|
1447 |
) |
|
1448 |
#(#MenuItem |
|
1449 |
#label: 'Right' |
|
1450 |
#translateLabel: true |
|
1451 |
#value: #doCropRight |
|
1452 |
#activeHelpKey: #cropRight |
|
986 | 1453 |
) |
1124 | 1454 |
#(#MenuItem |
1455 |
#label: 'Top' |
|
1456 |
#translateLabel: true |
|
1457 |
#value: #doCropTop |
|
1458 |
#activeHelpKey: #cropTop |
|
672 | 1459 |
) |
1124 | 1460 |
#(#MenuItem |
1461 |
#label: 'Bottom' |
|
1462 |
#translateLabel: true |
|
1463 |
#value: #doCropBottom |
|
1464 |
#activeHelpKey: #cropBottom |
|
400 | 1465 |
) |
1124 | 1466 |
#(#MenuItem |
1467 |
#label: '-' |
|
400 | 1468 |
) |
1124 | 1469 |
#(#MenuItem |
1470 |
#label: 'Manual...' |
|
1471 |
#translateLabel: true |
|
1472 |
#value: #doCropManual |
|
1473 |
#activeHelpKey: #cropManual |
|
400 | 1474 |
) |
1124 | 1475 |
) |
1476 |
nil |
|
400 | 1477 |
nil |
1124 | 1478 |
) |
400 | 1479 |
) |
1489 | 1480 |
#(#MenuItem |
1557 | 1481 |
#label: 'Shift...' |
1482 |
#translateLabel: true |
|
1483 |
#value: #doShiftManual |
|
1484 |
#activeHelpKey: #shiftManual |
|
1485 |
) |
|
1486 |
#(#MenuItem |
|
1489 | 1487 |
#label: 'Ungrop (Add Border)...' |
1488 |
#translateLabel: true |
|
1489 |
#value: #doUnCropManual |
|
1490 |
#activeHelpKey: #uncropManual |
|
1491 |
) |
|
1124 | 1492 |
) |
1493 |
nil |
|
1494 |
nil |
|
400 | 1495 |
) |
1124 | 1496 |
) |
1497 |
#(#MenuItem |
|
1498 |
#label: 'ColorMap' |
|
1499 |
#translateLabel: true |
|
1500 |
#activeHelpKey: #colorMap |
|
1501 |
#enabled: #imageIsLoaded |
|
1502 |
#submenu: |
|
1503 |
#(#Menu |
|
1504 |
#( |
|
1505 |
#(#MenuItem |
|
1506 |
#label: '8-Plane' |
|
1507 |
#translateLabel: true |
|
1508 |
#value: #colorMapMode: |
|
1509 |
#activeHelpKey: #colorMap8 |
|
1510 |
#argument: '8-plane' |
|
1511 |
#choice: #colorMapMode |
|
1512 |
#choiceValue: '8-plane' |
|
1513 |
) |
|
1514 |
#(#MenuItem |
|
1515 |
#label: '4-Plane' |
|
1516 |
#translateLabel: true |
|
1517 |
#value: #colorMapMode: |
|
1518 |
#activeHelpKey: #colorMap4 |
|
1519 |
#argument: '4-plane' |
|
1520 |
#choice: #colorMapMode |
|
1521 |
#choiceValue: '4-plane' |
|
1522 |
) |
|
1523 |
#(#MenuItem |
|
1524 |
#label: '2-Plane' |
|
1525 |
#translateLabel: true |
|
1526 |
#value: #colorMapMode: |
|
1527 |
#activeHelpKey: #colorMap2 |
|
1528 |
#argument: '2-plane' |
|
1529 |
#choice: #colorMapMode |
|
1530 |
#choiceValue: '2-plane' |
|
1531 |
) |
|
1532 |
#(#MenuItem |
|
1533 |
#label: '1-Plane' |
|
1534 |
#translateLabel: true |
|
1535 |
#value: #colorMapMode: |
|
1536 |
#activeHelpKey: #colorMap1 |
|
1537 |
#argument: '1-plane' |
|
1538 |
#choice: #colorMapMode |
|
1539 |
#choiceValue: '1-plane' |
|
1540 |
) |
|
1541 |
#(#MenuItem |
|
1542 |
#label: '-' |
|
1543 |
) |
|
1544 |
#(#MenuItem |
|
1545 |
#label: '8-Plane + Mask' |
|
1546 |
#translateLabel: true |
|
1547 |
#value: #colorMapMode: |
|
1548 |
#activeHelpKey: #colorMap8M |
|
1549 |
#argument: '8-plane + mask' |
|
1550 |
#choice: #colorMapMode |
|
1551 |
#choiceValue: '8-plane + mask' |
|
1552 |
) |
|
1553 |
#(#MenuItem |
|
1554 |
#label: '4-Plane + Mask' |
|
1555 |
#translateLabel: true |
|
1556 |
#value: #colorMapMode: |
|
1557 |
#activeHelpKey: #colorMap4M |
|
1558 |
#argument: '4-plane + mask' |
|
1559 |
#choice: #colorMapMode |
|
1560 |
#choiceValue: '4-plane + mask' |
|
737 | 1561 |
) |
1124 | 1562 |
#(#MenuItem |
1563 |
#label: '2-Plane + Mask' |
|
1564 |
#translateLabel: true |
|
1565 |
#value: #colorMapMode: |
|
1566 |
#activeHelpKey: #colorMap2M |
|
1567 |
#argument: '2-plane + mask' |
|
1568 |
#choice: #colorMapMode |
|
1569 |
#choiceValue: '2-plane + mask' |
|
1570 |
) |
|
1571 |
#(#MenuItem |
|
1572 |
#label: '1-Plane + Mask' |
|
1573 |
#translateLabel: true |
|
1574 |
#value: #colorMapMode: |
|
1575 |
#activeHelpKey: #colorMap1M |
|
1576 |
#argument: '1-plane + mask' |
|
1577 |
#choice: #colorMapMode |
|
1578 |
#choiceValue: '1-plane + mask' |
|
1579 |
) |
|
1580 |
#(#MenuItem |
|
1581 |
#label: '-' |
|
1582 |
) |
|
1583 |
#(#MenuItem |
|
1584 |
#label: 'Compress colormap' |
|
1585 |
#translateLabel: true |
|
1586 |
#value: #compressColorMap |
|
1587 |
#activeHelpKey: #compressColormap |
|
1588 |
#enabled: #hasColormap |
|
1589 |
) |
|
1590 |
#(#MenuItem |
|
1591 |
#label: 'Sort colormap' |
|
1592 |
#translateLabel: true |
|
1593 |
#value: #sortColorMap |
|
1594 |
#enabled: #hasColormap |
|
1595 |
) |
|
1596 |
#(#MenuItem |
|
1403 | 1597 |
#label: 'Clear masked pixels' |
1598 |
#translateLabel: true |
|
1599 |
#value: #clearMaskedPixels |
|
1600 |
) |
|
1601 |
#(#MenuItem |
|
1124 | 1602 |
#label: '-' |
1603 |
) |
|
1604 |
#(#MenuItem |
|
1605 |
#label: 'Reduce number of colors...' |
|
1606 |
#translateLabel: true |
|
1607 |
#value: #reduceNumberOfColors |
|
1608 |
) |
|
1436 | 1609 |
#(#MenuItem |
1610 |
#label: 'Make GrayScale Image' |
|
1611 |
#translateLabel: true |
|
1612 |
#value: #makeGrayScale |
|
1613 |
) |
|
1480 | 1614 |
#(#MenuItem |
1615 |
#label: '-' |
|
1616 |
) |
|
1617 |
#(#MenuItem |
|
1618 |
#label: 'Copy mask' |
|
1619 |
#translateLabel: true |
|
1620 |
#value: #copyMask |
|
1621 |
#activeHelpKey: #copyMask |
|
1622 |
#enabled: #hasMask |
|
1623 |
) |
|
1624 |
#(#MenuItem |
|
1625 |
#label: 'Paste mask' |
|
1626 |
#translateLabel: true |
|
1627 |
#value: #pasteMask |
|
1628 |
#activeHelpKey: #pasteMask |
|
1629 |
#enabled: #hasMask |
|
1630 |
) |
|
1124 | 1631 |
) |
1632 |
nil |
|
1633 |
nil |
|
756 | 1634 |
) |
1124 | 1635 |
) |
1636 |
#(#MenuItem |
|
1637 |
#label: 'Settings' |
|
1638 |
#translateLabel: true |
|
1639 |
#submenu: |
|
1640 |
#(#Menu |
|
1641 |
#( |
|
1642 |
#(#MenuItem |
|
1353 | 1643 |
#label: 'Grid Magnification Limit...' |
1124 | 1644 |
#translateLabel: true |
1645 |
#value: #doChangeGridMagnification |
|
1646 |
#activeHelpKey: #settingsGridMagnification |
|
1647 |
) |
|
1648 |
) |
|
1649 |
nil |
|
1650 |
nil |
|
400 | 1651 |
) |
1124 | 1652 |
) |
1653 |
#(#MenuItem |
|
1654 |
#label: 'History' |
|
1655 |
#translateLabel: true |
|
1656 |
#activeHelpKey: #history |
|
1657 |
#submenuChannel: #menuHistory |
|
1658 |
) |
|
1659 |
#(#MenuItem |
|
1660 |
#label: 'Help' |
|
1661 |
#translateLabel: true |
|
1662 |
#startGroup: #right |
|
1663 |
#activeHelpKey: #help |
|
1664 |
#submenuChannel: #menuHelp |
|
1665 |
) |
|
1666 |
) |
|
1667 |
nil |
|
1668 |
nil |
|
400 | 1669 |
) |
1670 |
! |
|
1671 |
||
679 | 1672 |
menuMouseButtonColors |
737 | 1673 |
"This resource specification was automatically generated |
1674 |
by the MenuEditor of ST/X." |
|
679 | 1675 |
|
737 | 1676 |
"Do not manually edit this!! If it is corrupted, |
1677 |
the MenuEditor may not be able to read the specification." |
|
679 | 1678 |
|
1679 |
" |
|
1680 |
MenuEditor new openOnClass:ImageEditor andSelector:#menuMouseButtonColors |
|
1681 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menuMouseButtonColors)) startUp |
|
1682 |
" |
|
1683 |
||
1684 |
<resource: #menu> |
|
1685 |
||
1686 |
^ |
|
1687 |
||
1688 |
#(#Menu |
|
1689 |
||
1690 |
#( |
|
1691 |
#(#MenuItem |
|
1692 |
#label: 'Left Mouse Button' |
|
1693 |
#nameKey: #leftMouseKeyButton |
|
1694 |
#activeHelpKey: #mouseKeyColorMode |
|
975 | 1695 |
#enabled: #imageIsLoaded |
679 | 1696 |
#labelImage: #(#ResourceRetriever nil #leftMouseKeyIcon) |
975 | 1697 |
#choice: #mouseKeyColorMode |
1698 |
#choiceValue: 1 |
|
679 | 1699 |
) |
1700 |
#(#MenuItem |
|
1701 |
#label: 'Right Mouse Button' |
|
1702 |
#nameKey: #rightMouseKeyButton |
|
1703 |
#activeHelpKey: #mouseKeyColorMode |
|
975 | 1704 |
#enabled: #imageIsLoaded |
679 | 1705 |
#labelImage: #(#ResourceRetriever nil #rightMouseKeyIcon) |
975 | 1706 |
#choice: #mouseKeyColorMode |
1707 |
#choiceValue: 2 |
|
679 | 1708 |
) |
1709 |
) nil |
|
1710 |
nil |
|
1711 |
) |
|
1712 |
! |
|
1713 |
||
400 | 1714 |
menuToolbar |
737 | 1715 |
"This resource specification was automatically generated |
1716 |
by the MenuEditor of ST/X." |
|
400 | 1717 |
|
737 | 1718 |
"Do not manually edit this!! If it is corrupted, |
1719 |
the MenuEditor may not be able to read the specification." |
|
400 | 1720 |
|
1721 |
" |
|
1722 |
MenuEditor new openOnClass:ImageEditor andSelector:#menuToolbar |
|
1723 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menuToolbar)) startUp |
|
1724 |
" |
|
1725 |
||
1726 |
<resource: #menu> |
|
1727 |
||
1196 | 1728 |
^ |
1729 |
#(#Menu |
|
1730 |
#( |
|
1731 |
#(#MenuItem |
|
1732 |
#label: 'newImage' |
|
1733 |
#isButton: true |
|
1734 |
#value: #doNewImage |
|
1735 |
#activeHelpKey: #fileNewImage |
|
1736 |
#labelImage: #(#ResourceRetriever #Icon #newIcon) |
|
1737 |
) |
|
1738 |
#(#MenuItem |
|
1739 |
#label: 'loadFromClass' |
|
1740 |
#isButton: true |
|
1741 |
#value: #doLoadFromClass |
|
1742 |
#activeHelpKey: #fileLoadFromClass |
|
1743 |
#labelImage: #(#ResourceRetriever #Icon #loadIcon) |
|
1744 |
) |
|
1745 |
#(#MenuItem |
|
1746 |
#label: 'saveMethod' |
|
1747 |
#isButton: true |
|
1748 |
#value: #doSaveMethod |
|
1749 |
#activeHelpKey: #fileSaveMethod |
|
1750 |
#enabled: #imageIsLoaded |
|
1751 |
#labelImage: #(#ResourceRetriever #Icon #saveIcon) |
|
1752 |
) |
|
1753 |
#(#MenuItem |
|
1754 |
#label: '' |
|
1755 |
) |
|
1756 |
#(#MenuItem |
|
1757 |
#label: '' |
|
1758 |
) |
|
1759 |
#(#MenuItem |
|
1760 |
#label: '' |
|
1761 |
) |
|
1762 |
#(#MenuItem |
|
1763 |
#label: '' |
|
1764 |
) |
|
1765 |
#(#MenuItem |
|
1766 |
#label: 'Point' |
|
1767 |
#activeHelpKey: #drawModePoint |
|
1768 |
#enabled: #imageIsLoaded |
|
1769 |
#choice: #editMode |
|
1770 |
#choiceValue: #point |
|
1771 |
) |
|
1772 |
#(#MenuItem |
|
1773 |
#label: 'Rect' |
|
1774 |
#activeHelpKey: #drawModeBox |
|
1775 |
#enabled: #imageIsLoaded |
|
1776 |
#choice: #editMode |
|
1777 |
#choiceValue: #box |
|
1778 |
) |
|
1779 |
#(#MenuItem |
|
1780 |
#label: 'FillRect' |
|
1781 |
#activeHelpKey: #drawModeFilledBox |
|
1782 |
#enabled: #imageIsLoaded |
|
1783 |
#choice: #editMode |
|
1784 |
#choiceValue: #filledBox |
|
1785 |
) |
|
1786 |
#(#MenuItem |
|
1787 |
#label: 'Fill' |
|
1788 |
#activeHelpKey: #drawModeFill |
|
1789 |
#enabled: #imageIsLoaded |
|
1790 |
#choice: #editMode |
|
1791 |
#choiceValue: #fill |
|
1792 |
) |
|
1793 |
#(#MenuItem |
|
1794 |
#label: 'Copy' |
|
1795 |
#activeHelpKey: #drawModeCopy |
|
1796 |
#enabled: #imageIsLoaded |
|
1797 |
#choice: #editMode |
|
1798 |
#choiceValue: #copy |
|
1799 |
) |
|
1800 |
#(#MenuItem |
|
1801 |
#label: 'Paste' |
|
1802 |
#activeHelpKey: #drawModePaste |
|
1803 |
#enabled: #imageIsLoaded |
|
1804 |
#choice: #editMode |
|
1805 |
#choiceValue: #paste |
|
1806 |
) |
|
1807 |
#(#MenuItem |
|
1808 |
#label: 'Paste Under' |
|
1809 |
#activeHelpKey: #drawModePasteUnder |
|
1810 |
#enabled: #imageIsLoaded |
|
1811 |
#choice: #editMode |
|
1812 |
#choiceValue: #pasteUnder |
|
1813 |
) |
|
1411 | 1814 |
#(#MenuItem |
1815 |
#label: 'Special' |
|
1816 |
#activeHelpKey: #drawModeSpecial |
|
1817 |
#enabled: #imageIsLoaded |
|
1818 |
#choice: #editMode |
|
1819 |
#choiceValue: #specialOperation |
|
1820 |
) |
|
1196 | 1821 |
) |
1822 |
nil |
|
1823 |
nil |
|
400 | 1824 |
) |
1825 |
! ! |
|
1826 |
||
1827 |
!ImageEditor methodsFor:'accessing'! |
|
1828 |
||
1829 |
image |
|
767 | 1830 |
"returns the current editing image" |
400 | 1831 |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1832 |
^ imageEditView image |
400 | 1833 |
! |
1834 |
||
1835 |
postOpenAction: anAction |
|
767 | 1836 |
"sets an action which is evaluated after opening" |
400 | 1837 |
|
1838 |
postOpenAction := anAction |
|
1381 | 1839 |
! |
1840 |
||
1841 |
resourceClass:aClass |
|
1842 |
imageEditView resourceClass:aClass |
|
400 | 1843 |
! ! |
1844 |
||
1398 | 1845 |
!ImageEditor methodsFor:'accessing-views'! |
400 | 1846 |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1847 |
colorDataSetView |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1848 |
"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
|
1849 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1850 |
^(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
|
1851 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1852 |
"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
|
1853 |
! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1854 |
|
487 | 1855 |
coordLabel |
767 | 1856 |
"returns the view the coord label" |
487 | 1857 |
|
1858 |
^builder componentAt: #coordLabel |
|
1859 |
! |
|
1860 |
||
400 | 1861 |
imageEditView |
911 | 1862 |
"returns the view of the image" |
400 | 1863 |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1864 |
imageEditView isNil ifTrue:[ |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1865 |
imageEditView := (builder componentAt: #imageEditView) scrolledView. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1866 |
imageEditView addDependent:self. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1867 |
]. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1868 |
^ imageEditView |
1345 | 1869 |
|
1870 |
"Modified: / 10.2.2000 / 23:19:20 / cg" |
|
400 | 1871 |
! |
1872 |
||
1873 |
imagePreView |
|
767 | 1874 |
"returns the preview of the image" |
400 | 1875 |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1876 |
^ (builder componentAt: #imagePreView) subViews first |
475 | 1877 |
! ! |
1878 |
||
400 | 1879 |
!ImageEditor methodsFor:'aspects'! |
1880 |
||
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1881 |
activityInfoHolder |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1882 |
^ self valueOfInfoLabel |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1883 |
|
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1884 |
"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
|
1885 |
! |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1886 |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1887 |
colorColumnAdaptor |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1888 |
^ self |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1889 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1890 |
"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
|
1891 |
! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1892 |
|
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1893 |
hasClassAndSelectorDefined |
1054 | 1894 |
^ [ |
1895 |
|clsName| |
|
1896 |
||
1897 |
(clsName := imageEditView resourceClass) size > 0 |
|
1898 |
and:[(Smalltalk at:clsName ifAbsent:nil) notNil |
|
1899 |
and:[imageEditView resourceSelector notNil]] |
|
1900 |
] |
|
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1901 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1902 |
"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
|
1903 |
! |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1904 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1905 |
hasClassDefined |
1054 | 1906 |
^ [ |
1907 |
|clsName| |
|
1908 |
||
1443 | 1909 |
(clsName := imageEditView resourceClass) size > 0 |
1054 | 1910 |
and:[(Smalltalk at:clsName ifAbsent:nil) notNil] |
1911 |
] |
|
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1912 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1913 |
"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
|
1914 |
! |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1915 |
|
1008 | 1916 |
hasColormap |
1917 |
^ [self image notNil and:[self image colorMap notNil]] |
|
1918 |
||
1919 |
"Created: / 30.9.1998 / 23:53:55 / cg" |
|
1920 |
! |
|
1921 |
||
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1922 |
imageHasNextImage |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1923 |
"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
|
1924 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1925 |
^ [self image notNil |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1926 |
and:[self image imageSequence notNil]] |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1927 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1928 |
"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
|
1929 |
! |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1930 |
|
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1931 |
imageInfoHolder |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1932 |
|holder| |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1933 |
(holder := builder bindingAt:#imageInfoHolder) isNil ifTrue:[ |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1934 |
builder aspectAt:#imageInfoHolder put:(holder := '' asValue). |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1935 |
]. |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1936 |
^ holder |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1937 |
|
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1938 |
"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
|
1939 |
! |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1940 |
|
400 | 1941 |
imageIsLoaded |
767 | 1942 |
"returns whether an image is loaded as value holder" |
400 | 1943 |
|
1944 |
|holder| |
|
1945 |
(holder := builder bindingAt:#imageIsLoaded) isNil ifTrue:[ |
|
1946 |
builder aspectAt:#imageIsLoaded put:(holder := false asValue). |
|
1947 |
]. |
|
1948 |
^ holder |
|
1949 |
! |
|
1950 |
||
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1951 |
imageIsLoadedAndClassDefined |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1952 |
"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
|
1953 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1954 |
^ [self hasClassAndSelectorDefined value |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1955 |
and:[self imageIsLoaded value]] |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1956 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1957 |
"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
|
1958 |
! |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1959 |
|
400 | 1960 |
listOfColors |
767 | 1961 |
"returns the list of colors in a List" |
400 | 1962 |
|
1963 |
|holder| |
|
1964 |
(holder := builder bindingAt:#listOfColors) isNil ifTrue:[ |
|
1965 |
builder aspectAt:#listOfColors put:(holder := List new). |
|
942 | 1966 |
holder addDependent:self. |
400 | 1967 |
]. |
1968 |
^ holder |
|
1969 |
! |
|
1970 |
||
1971 |
selectionOfColor |
|
767 | 1972 |
"returns current selection of the edit color as an AspectAdaptor" |
400 | 1973 |
|
1974 |
|holder| |
|
1975 |
(holder := builder bindingAt:#selectionOfColor) isNil ifTrue:[ |
|
1976 |
builder aspectAt:#selectionOfColor put:( |
|
1977 |
holder := AspectAdaptor new subject:self; forAspect:#selectedColorIndex). |
|
1978 |
]. |
|
1979 |
^ holder |
|
1980 |
! |
|
1981 |
||
1982 |
valueOfMagnification |
|
767 | 1983 |
"returns current magnification of the image as an AspectAdaptor" |
400 | 1984 |
|
1985 |
|holder| |
|
1986 |
(holder := builder bindingAt:#valueOfMagnification) isNil ifTrue:[ |
|
1987 |
builder aspectAt:#valueOfMagnification put:( |
|
1988 |
holder := AspectAdaptor new subject:self; forAspect:#magnification) |
|
1989 |
]. |
|
1990 |
^ holder |
|
1991 |
! ! |
|
1992 |
||
767 | 1993 |
!ImageEditor methodsFor:'change & update'! |
1994 |
||
1995 |
findColorMapMode |
|
899 | 1996 |
"finds the colorMapMode for a new image" |
767 | 1997 |
|
1054 | 1998 |
|image listOfColors| |
1999 |
||
2000 |
image := self image. |
|
2001 |
image depth > 8 ifTrue: [ |
|
2002 |
colorMapMode value: ''. |
|
2003 |
self listOfColors removeAll. |
|
2004 |
^ nil |
|
2005 |
]. |
|
2006 |
||
2007 |
colorMapMode value:(image depth printString, '-plane'). |
|
2008 |
||
2009 |
(listOfColors := self listOfColors) isEmpty ifTrue:[ |
|
2010 |
self colorMapMode: colorMapMode value. |
|
2011 |
listOfColors := self listOfColors. |
|
2012 |
image := self image. |
|
767 | 2013 |
]. |
1491
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2014 |
imageEditView drawingColors:(Array |
1054 | 2015 |
with: (listOfColors at:1) |
2016 |
with: (listOfColors at:2 ifAbsent:[listOfColors at:1])). |
|
2017 |
||
2018 |
image mask notNil ifTrue: [ |
|
2019 |
colorMapMode value:(colorMapMode value, ' + mask'). |
|
2020 |
||
1491
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2021 |
(listOfColors detect: [:clr| clr = (Color colorId:0)] ifNone: nil) isNil |
1054 | 2022 |
ifTrue:[ |
1491
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2023 |
listOfColors addFirst:(Color colorId:0). |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2024 |
imageEditView drawingColors: (Array |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2025 |
with:(listOfColors at:2 ifAbsent:[listOfColors at:1]) |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2026 |
with:(listOfColors at:1)). |
898 | 2027 |
] |
767 | 2028 |
]. |
1054 | 2029 |
self selectionOfColor |
1446 | 2030 |
setValue: 0; |
1054 | 2031 |
value: (self listOfColors indexOf: imageEditView selectedColor). |
767 | 2032 |
! |
2033 |
||
942 | 2034 |
update:something with:aParameter from:changedObject |
1491
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2035 |
|clrIndex img | |
1436 | 2036 |
|
2037 |
img := self image. |
|
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2038 |
changedObject == self listOfColors ifTrue:[ |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2039 |
something == #at: ifTrue:[ |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2040 |
"/ colormap entry changed at aParameter |
960 | 2041 |
|
2042 |
clrIndex := aParameter. |
|
2043 |
(self hasMask) ifTrue:[ |
|
2044 |
clrIndex := clrIndex - 1. |
|
2045 |
]. |
|
2046 |
||
1436 | 2047 |
img colorMap at:clrIndex put:(changedObject at:aParameter). |
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2048 |
self colorMapChanged. |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2049 |
^ self |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2050 |
]. |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2051 |
]. |
1124 | 2052 |
|
2053 |
changedObject == imageEditView undoImages ifTrue:[ |
|
2054 |
self valueOfCanUndo value:(changedObject notEmpty). |
|
2055 |
^ self. |
|
2056 |
]. |
|
2057 |
||
1345 | 2058 |
changedObject == imageEditView ifTrue:[ |
2059 |
something == #imageColors ifTrue:[ |
|
1436 | 2060 |
self listOfColors contents:img colorMap. |
1345 | 2061 |
self findColorMapMode. |
2062 |
^ self. |
|
2063 |
]. |
|
2064 |
something == #image ifTrue:[ |
|
1436 | 2065 |
self imagePreView image:img. |
2066 |
self listOfColors contents:img colorMap. |
|
2067 |
self findColorMapMode. |
|
1345 | 2068 |
^ self. |
2069 |
]. |
|
2070 |
something == #subImageIn ifTrue:[ |
|
1436 | 2071 |
self imagePreView image ~~ img ifTrue:[ |
1406 | 2072 |
self halt:'should not happen'. |
2073 |
]. |
|
1345 | 2074 |
self imagePreView redraw:aParameter. |
2075 |
^ self. |
|
2076 |
]. |
|
1491
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2077 |
something == #selectedColor ifTrue:[ |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2078 |
(aParameter = (Color colorId:0)) ifTrue:[ |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2079 |
self halt. |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2080 |
]. |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2081 |
clrIndex := self listOfColors indexOf:aParameter. |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2082 |
self selectionOfColor value:clrIndex. |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2083 |
^ self. |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2084 |
]. |
1345 | 2085 |
^ self. |
2086 |
]. |
|
2087 |
||
2088 |
changedObject == imageEditView image ifTrue:[ |
|
1377 | 2089 |
self halt:'to be implemented'. |
1345 | 2090 |
^ self. |
2091 |
]. |
|
2092 |
||
942 | 2093 |
super update:something with:aParameter from:changedObject |
2094 |
||
1345 | 2095 |
"Modified: / 10.2.2000 / 23:36:49 / cg" |
942 | 2096 |
! |
2097 |
||
1054 | 2098 |
updateForNoImage |
767 | 2099 |
"updates channels and view, if image is loaded" |
2100 |
||
2101 |
self imageIsLoaded value: false. |
|
2102 |
self listOfColors removeAll. |
|
2103 |
self imagePreView image: nil |
|
2104 |
||
2105 |
||
2106 |
||
2107 |
||
2108 |
! |
|
2109 |
||
2110 |
updateLabelsAndHistory |
|
2111 |
"updates labels and history, if something has changed" |
|
2112 |
||
2113 |
self imageIsLoaded value: self image notNil. |
|
2114 |
||
2115 |
self image isNil ifTrue: [^nil]. |
|
2116 |
||
2117 |
self updateInfoLabel. |
|
2118 |
||
911 | 2119 |
imageEditView resourceMessage asCollectionOfWords size = 2 |
2120 |
ifTrue: [self addToHistory: imageEditView resourceMessage -> #loadFromMessage:]. |
|
767 | 2121 |
|
2122 |
self image fileName notNil |
|
2123 |
ifTrue: [self addToHistory: self image fileName -> #loadFromFile:]. |
|
2124 |
||
2125 |
||
2126 |
||
2127 |
! ! |
|
2128 |
||
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2129 |
!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
|
2130 |
|
942 | 2131 |
blueAtColor:aColor put:newBlue |
2132 |
"helper used to return a new row element, when blue is changed" |
|
2133 |
||
2134 |
|byte| |
|
2135 |
||
2136 |
aColor isNil ifTrue:[^ aColor]. "/ mask cannot be changed |
|
2137 |
byte := newBlue clampBetween:0 and:255. |
|
960 | 2138 |
byte = aColor blueByte ifTrue:[^ aColor]. |
942 | 2139 |
^ Color redByte:(aColor redByte) greenByte:(aColor greenByte) blueByte:byte |
960 | 2140 |
|
2141 |
"Modified: / 18.8.1998 / 17:00:12 / cg" |
|
942 | 2142 |
! |
2143 |
||
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2144 |
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
|
2145 |
"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
|
2146 |
|
930 | 2147 |
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
|
2148 |
^ 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
|
2149 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2150 |
"Created: / 26.7.1998 / 12:30:35 / cg" |
930 | 2151 |
"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
|
2152 |
! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2153 |
|
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2154 |
canSelectBlueInColor:aColor |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2155 |
^ aColor blueByte notNil |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2156 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2157 |
"Created: / 7.8.1998 / 22:50:34 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2158 |
"Modified: / 7.8.1998 / 22:52:57 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2159 |
! |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2160 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2161 |
canSelectGreenInColor:aColor |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2162 |
^ aColor greenByte notNil |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2163 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2164 |
"Created: / 7.8.1998 / 22:50:22 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2165 |
"Modified: / 7.8.1998 / 22:52:46 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2166 |
! |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2167 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2168 |
canSelectRedInColor:aColor |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2169 |
^ aColor redByte notNil |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2170 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2171 |
"Created: / 7.8.1998 / 22:50:00 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2172 |
"Modified: / 7.8.1998 / 22:51:03 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2173 |
! |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2174 |
|
942 | 2175 |
greenAtColor:aColor put:newGreen |
2176 |
"helper used to return a new row element, when green is changed" |
|
2177 |
||
2178 |
|byte| |
|
2179 |
||
2180 |
aColor isNil ifTrue:[^ aColor]. "/ mask cannot be changed |
|
2181 |
byte := newGreen clampBetween:0 and:255. |
|
960 | 2182 |
byte = aColor greenByte ifTrue:[^ aColor]. |
942 | 2183 |
^ Color redByte:(aColor redByte) greenByte:byte blueByte:(aColor blueByte) |
960 | 2184 |
|
2185 |
"Modified: / 18.8.1998 / 17:00:38 / cg" |
|
942 | 2186 |
! |
2187 |
||
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2188 |
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
|
2189 |
"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
|
2190 |
|
930 | 2191 |
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
|
2192 |
^ 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
|
2193 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2194 |
"Created: / 26.7.1998 / 12:30:29 / cg" |
930 | 2195 |
"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
|
2196 |
! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2197 |
|
942 | 2198 |
redAtColor:aColor put:newRed |
2199 |
"helper used to return a new row element, when red is changed" |
|
2200 |
||
2201 |
|byte| |
|
2202 |
||
2203 |
aColor isNil ifTrue:[^ aColor]. "/ mask cannot be changed |
|
2204 |
byte := newRed clampBetween:0 and:255. |
|
960 | 2205 |
byte = aColor redByte ifTrue:[^ aColor]. |
942 | 2206 |
^ Color redByte:byte greenByte:(aColor greenByte) blueByte:(aColor blueByte) |
960 | 2207 |
|
2208 |
"Modified: / 18.8.1998 / 17:00:49 / cg" |
|
942 | 2209 |
! |
2210 |
||
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2211 |
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
|
2212 |
"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
|
2213 |
|
930 | 2214 |
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
|
2215 |
^ 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
|
2216 |
|
930 | 2217 |
"Modified: / 31.7.1998 / 01:11:35 / cg" |
1449
49ad9f552d64
oops - fixed bg-color access in dataset
Claus Gittinger <cg@exept.de>
parents:
1446
diff
changeset
|
2218 |
! |
49ad9f552d64
oops - fixed bg-color access in dataset
Claus Gittinger <cg@exept.de>
parents:
1446
diff
changeset
|
2219 |
|
49ad9f552d64
oops - fixed bg-color access in dataset
Claus Gittinger <cg@exept.de>
parents:
1446
diff
changeset
|
2220 |
theColorItSelf:aColor |
49ad9f552d64
oops - fixed bg-color access in dataset
Claus Gittinger <cg@exept.de>
parents:
1446
diff
changeset
|
2221 |
^ aColor |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2222 |
! ! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2223 |
|
672 | 2224 |
!ImageEditor methodsFor:'help'! |
2225 |
||
2226 |
defaultInfoLabel |
|
767 | 2227 |
"returns the default info label" |
672 | 2228 |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2229 |
|resourceClass| |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2230 |
|
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2231 |
resourceClass := imageEditView resourceClass. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2232 |
(resourceClass isSymbol and: [(Smalltalk at:resourceClass) isClass]) |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2233 |
ifTrue:[ |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2234 |
^ resourceClass, ' >> ', imageEditView resourceSelector |
672 | 2235 |
]. |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2236 |
^ 'No class and selector defined.' |
674 | 2237 |
! |
2238 |
||
702 | 2239 |
openDocumentation |
767 | 2240 |
"opens the documentation file of the Image Editor" |
674 | 2241 |
|
763 | 2242 |
self openHTMLDocument: 'tools/uipainter/ImageEditor.html' |
2243 |
||
672 | 2244 |
! ! |
2245 |
||
767 | 2246 |
!ImageEditor methodsFor:'loading'! |
2247 |
||
2248 |
loadFromFile: aFileName |
|
2249 |
"loads an image from aFileName and sets up color map list and other info labels" |
|
2250 |
||
960 | 2251 |
|img| |
2252 |
||
980
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2253 |
self withCursor:Cursor wait do:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2254 |
(imageEditView loadFromFile: aFileName) notNil ifTrue:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2255 |
(img := self image) notNil ifTrue:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2256 |
img colorMap notNil ifTrue:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2257 |
self listOfColors contents:(img usedColors asSet asOrderedCollection). |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2258 |
] ifFalse:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2259 |
self listOfColors removeAll. |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2260 |
]. |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2261 |
self findColorMapMode. |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2262 |
self updateLabelsAndHistory. |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2263 |
img := img onDevice:device. |
1057 | 2264 |
imageEditView image:img. |
960 | 2265 |
] ifFalse:[ |
1054 | 2266 |
self updateForNoImage |
1057 | 2267 |
]. |
767 | 2268 |
] |
2269 |
] |
|
960 | 2270 |
|
1057 | 2271 |
"Modified: / 16.3.1999 / 21:44:26 / cg" |
767 | 2272 |
! |
2273 |
||
960 | 2274 |
loadFromImage:anImage |
767 | 2275 |
"loads an image from anImage and sets up color map list and other info labels" |
2276 |
||
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2277 |
|img| |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2278 |
|
1057 | 2279 |
anImage notNil ifTrue:[ |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2280 |
img := anImage onDevice:device. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2281 |
]. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2282 |
|
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2283 |
imageEditView image:img. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2284 |
|
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2285 |
img notNil ifTrue:[ |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2286 |
img colorMap notNil ifTrue:[ |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2287 |
self listOfColors contents:(img usedColors asSet asOrderedCollection). |
960 | 2288 |
] ifFalse:[ |
767 | 2289 |
self listOfColors removeAll. |
2290 |
]. |
|
2291 |
self findColorMapMode. |
|
2292 |
self updateLabelsAndHistory. |
|
960 | 2293 |
] ifFalse:[ |
1054 | 2294 |
self updateForNoImage |
767 | 2295 |
] |
960 | 2296 |
|
1057 | 2297 |
"Modified: / 16.3.1999 / 21:43:56 / cg" |
767 | 2298 |
! |
2299 |
||
2300 |
loadFromMessage: aMessage |
|
2301 |
"loads an image by evaluating aMessage and sets up color map list and other info labels" |
|
2302 |
||
960 | 2303 |
|img| |
2304 |
||
2305 |
(imageEditView loadFromMessage: aMessage) notNil ifTrue:[ |
|
2306 |
(img := self image) notNil ifTrue:[ |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2307 |
img := img onDevice:device. |
960 | 2308 |
self listOfColors contents:(img usedColors asSet asOrderedCollection). |
767 | 2309 |
self findColorMapMode. |
2310 |
self updateLabelsAndHistory. |
|
1057 | 2311 |
imageEditView image:img. |
960 | 2312 |
] ifFalse:[ |
1054 | 2313 |
self updateForNoImage |
767 | 2314 |
] |
2315 |
] |
|
960 | 2316 |
|
1057 | 2317 |
"Modified: / 16.3.1999 / 21:44:41 / cg" |
767 | 2318 |
! |
2319 |
||
2320 |
loadFromOrPrepareForMessage: aMessage |
|
2321 |
"loads an image by evaluating aMessage; |
|
2322 |
if no image could extract from aMessage; do set the class and the selector from |
|
2323 |
the aMessage for a saving at the end of editing" |
|
2324 |
||
911 | 2325 |
(imageEditView loadFromMessage: aMessage) notNil |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2326 |
ifTrue: [ |
767 | 2327 |
self listOfColors contents: self image usedColors asSet asOrderedCollection. |
2328 |
self findColorMapMode. |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2329 |
] ifFalse: [ |
911 | 2330 |
imageEditView resourceMessage: aMessage. |
767 | 2331 |
]. |
2332 |
self updateLabelsAndHistory. |
|
1057 | 2333 |
|
2334 |
"Modified: / 16.3.1999 / 21:45:07 / cg" |
|
767 | 2335 |
! ! |
2336 |
||
400 | 2337 |
!ImageEditor methodsFor:'menu modes'! |
2338 |
||
975 | 2339 |
colorMapMode |
2340 |
"returns colorMapMode" |
|
400 | 2341 |
|
975 | 2342 |
colorMapMode isNil ifTrue: [colorMapMode := '' asValue]. |
400 | 2343 |
|
975 | 2344 |
^colorMapMode |
400 | 2345 |
! |
2346 |
||
975 | 2347 |
editMode |
2348 |
"returns editMode" |
|
400 | 2349 |
|
1054 | 2350 |
editMode isNil ifTrue: [ |
975 | 2351 |
editMode := #point asValue. |
1329 | 2352 |
editMode onChangeEvaluate:[imageEditView editMode:(editMode value)] |
975 | 2353 |
]. |
2354 |
||
2355 |
^editMode |
|
400 | 2356 |
! |
2357 |
||
975 | 2358 |
mouseKeyColorMode |
2359 |
"returns mouseKeyColorMode" |
|
400 | 2360 |
|
1345 | 2361 |
mouseKeyColorMode isNil ifTrue:[ |
975 | 2362 |
mouseKeyColorMode := 1 asValue. |
1345 | 2363 |
mouseKeyColorMode onChangeEvaluate: [ |
2364 |
imageEditView mouseKeyColorMode:mouseKeyColorMode value. |
|
2365 |
self selectionOfColor value: (self listOfColors indexOf:imageEditView selectedColor). |
|
2366 |
] |
|
956 | 2367 |
]. |
400 | 2368 |
|
975 | 2369 |
^mouseKeyColorMode |
1345 | 2370 |
|
2371 |
"Modified: / 10.2.2000 / 23:16:42 / cg" |
|
400 | 2372 |
! ! |
2373 |
||
535 | 2374 |
!ImageEditor methodsFor:'queries'! |
2375 |
||
960 | 2376 |
hasMask |
1556 | 2377 |
^ colorMapMode value notNil and:[colorMapMode value endsWith:'mask'] |
960 | 2378 |
|
2379 |
"Created: / 18.8.1998 / 17:17:38 / cg" |
|
2380 |
! |
|
2381 |
||
535 | 2382 |
preferredExtent |
767 | 2383 |
"returns the preferred extent" |
535 | 2384 |
|
2385 |
^super preferredExtent max: (Screen current width//3)@(Screen current height//3.5) |
|
2386 |
||
2387 |
||
2388 |
! ! |
|
2389 |
||
400 | 2390 |
!ImageEditor methodsFor:'selection'! |
2391 |
||
2392 |
magnification |
|
767 | 2393 |
"returns the magnification of the image" |
400 | 2394 |
|
911 | 2395 |
self imageEditView isNil ifTrue: [^1]. |
2396 |
^imageEditView magnification x |
|
400 | 2397 |
! |
2398 |
||
2399 |
magnification: aValue |
|
767 | 2400 |
"sets the magnification of the image" |
400 | 2401 |
|
905 | 2402 |
|magnification| |
2403 |
magnification := (aValue ? 1) asPoint. |
|
911 | 2404 |
(magnification = imageEditView magnification or: [magnification = (0@0)]) ifTrue: [^nil]. |
2405 |
imageEditView magnification: magnification |
|
400 | 2406 |
! |
2407 |
||
2408 |
selectedColorIndex |
|
767 | 2409 |
"returns the index of the selected color" |
400 | 2410 |
|
2411 |
^selectedColorIndex |
|
2412 |
! |
|
2413 |
||
2414 |
selectedColorIndex: anIndex |
|
767 | 2415 |
"sets the index of the selected color" |
400 | 2416 |
|
1054 | 2417 |
|clr pixel| |
2418 |
||
2419 |
selectedColorIndex := anIndex. |
|
2420 |
clr := self listOfColors at:anIndex ifAbsent:nil. |
|
2421 |
clr isNil ifTrue:[^ self]. |
|
2422 |
||
1075 | 2423 |
pixel := anIndex - 1. |
1054 | 2424 |
(self listOfColors at:1) = Color noColor ifTrue:[ |
2425 |
anIndex == 1 ifTrue:[ |
|
2426 |
pixel := nil. "/ mask |
|
2427 |
] ifFalse:[ |
|
1075 | 2428 |
pixel := pixel - 1 |
1054 | 2429 |
] |
2430 |
]. |
|
2431 |
imageEditView selectedColorIndex:pixel. |
|
2432 |
imageEditView selectedColor:clr. |
|
400 | 2433 |
|
2434 |
! ! |
|
2435 |
||
2436 |
!ImageEditor methodsFor:'startup / release'! |
|
2437 |
||
2438 |
closeRequest |
|
767 | 2439 |
"close request" |
400 | 2440 |
|
911 | 2441 |
imageEditView checkModified ifTrue:[super closeRequest] |
400 | 2442 |
|
2443 |
! |
|
2444 |
||
2445 |
open |
|
767 | 2446 |
"after opening, sets the masterApplication of the imageEditView to self" |
400 | 2447 |
|
2448 |
super open. |
|
444 | 2449 |
|
911 | 2450 |
imageEditView := (builder componentAt: #imageEditView) subViews first. |
400 | 2451 |
! |
2452 |
||
2453 |
postOpenWith:aBuilder |
|
767 | 2454 |
"after opening, sets the masterApplication of the imageEditView to self; |
2455 |
evaluate the postOpenAction" |
|
400 | 2456 |
|
1124 | 2457 |
imageEditView undoImages addDependent:self. |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2458 |
imageEditView imageInfoHolder:(self imageInfoHolder). |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2459 |
imageEditView activityInfoHolder:(self activityInfoHolder). |
1345 | 2460 |
imageEditView clickInfoCallBack:[:button :point | |
2461 |
|mouseButtonColorToolBar| |
|
2462 |
||
2463 |
mouseButtonColorToolBar := builder componentAt:#MouseButtonColorToolBar. |
|
2464 |
(mouseButtonColorToolBar itemAt:button) toggleIndication. |
|
2465 |
mouseButtonColorToolBar do: [:i| i updateIndicators]. |
|
2466 |
]. |
|
2467 |
imageEditView addDependent:self. |
|
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2468 |
|
400 | 2469 |
postOpenAction notNil ifTrue: [postOpenAction value]. |
2470 |
||
1250 | 2471 |
super postOpenWith:aBuilder. |
2472 |
||
2473 |
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
|
2474 |
|
1345 | 2475 |
"Modified: / 10.2.2000 / 23:17:43 / cg" |
400 | 2476 |
! ! |
2477 |
||
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2478 |
!ImageEditor methodsFor:'user actions - colormap'! |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2479 |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2480 |
addColorToColormap |
1057 | 2481 |
|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
|
2482 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2483 |
img := self image. |
1499
0c57ab09156b
about menu items moved into the Help-menu
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2484 |
img isNil ifTrue:[ |
0c57ab09156b
about menu items moved into the Help-menu
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2485 |
self warn:'No Image.'. |
0c57ab09156b
about menu items moved into the Help-menu
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2486 |
^ self |
0c57ab09156b
about menu items moved into the Help-menu
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2487 |
]. |
0c57ab09156b
about menu items moved into the Help-menu
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2488 |
|
1054 | 2489 |
depth := img depth. |
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2490 |
cMap := img colorMap. |
1054 | 2491 |
cMap isNil ifTrue:[ |
1499
0c57ab09156b
about menu items moved into the Help-menu
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2492 |
self warn:'Image has no colormap.\Change colorMap mode first.' withCRs. |
1054 | 2493 |
^ self |
2494 |
]. |
|
2495 |
||
2496 |
((depth == 1) |
|
2497 |
or:[cMap size == (1 bitShift:depth)]) ifTrue:[ |
|
2498 |
depth >= 8 ifTrue:[ |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2499 |
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
|
2500 |
^ self |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2501 |
]. |
1054 | 2502 |
(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
|
2503 |
ifFalse:[ |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2504 |
^ self |
1057 | 2505 |
]. |
2506 |
||
2507 |
imageEditView makeUndo. |
|
2508 |
newMode := (depth*2) printString , (colorMapMode value copyFrom:2). |
|
2509 |
self colorMapMode:newMode. |
|
2510 |
] ifFalse:[ |
|
2511 |
imageEditView makeUndo. |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2512 |
]. |
1054 | 2513 |
|
2514 |
cMap := cMap asArray. |
|
2515 |
oldCListSize := self listOfColors size. |
|
2516 |
||
2517 |
"/ (colorMapMode value asString endsWith:'mask') ifTrue:[ |
|
2518 |
"/ cMap last = Color noColor ifTrue:[ |
|
2519 |
"/ cMap := cMap copyWithoutLast:1 |
|
2520 |
"/ ] ifFalse:[ |
|
2521 |
"/ cMap first = Color noColor ifTrue:[ |
|
2522 |
"/ cMap := cMap copyFrom:2 |
|
2523 |
"/ ] |
|
2524 |
"/ ]. |
|
2525 |
"/ ]. |
|
2526 |
"/ |
|
2527 |
||
2528 |
newColorMap := cMap copyWith:(Color black). |
|
2529 |
||
2530 |
newImage := img species new |
|
2531 |
width:img width |
|
2532 |
height:img height |
|
2533 |
depth:depth |
|
2534 |
fromArray:img bits. |
|
2535 |
||
2536 |
newImage colorMap:newColorMap. |
|
2537 |
newImage fileName:img fileName. |
|
2538 |
newImage mask:(img mask copy). |
|
2539 |
||
2540 |
(imageEditView image:newImage) notNil ifTrue:[ |
|
2541 |
self listOfColors contents: newImage colorMap. |
|
2542 |
self findColorMapMode. |
|
2543 |
"/ mhmh - somehow, we get two colors added ... (sigh findColorMapMode adds another one ...) |
|
2544 |
self listOfColors size > (oldCListSize + 1) ifTrue:[ |
|
2545 |
self listOfColors removeLast |
|
2546 |
]. |
|
2547 |
self selectionOfColor value:(self listOfColors size). |
|
2548 |
self updateLabelsAndHistory. |
|
2549 |
] |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2550 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2551 |
"Created: / 12.3.1999 / 00:20:28 / cg" |
1057 | 2552 |
"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
|
2553 |
! |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2554 |
|
1403 | 2555 |
clearMaskedPixels |
2556 |
"clear all masked pixels (to pixelValue 0)" |
|
2557 |
||
1460 | 2558 |
|newImage oldImage| |
1403 | 2559 |
|
2560 |
oldImage := self image. |
|
2561 |
||
2562 |
imageEditView makeUndo. |
|
2563 |
||
2564 |
self withExecuteCursorDo:[ |
|
2565 |
newImage := oldImage clearMaskedPixels. |
|
1460 | 2566 |
0 to:newImage height - 1 do:[:y | |
2567 |
0 to:newImage width - 1 do:[:x | |
|
2568 |
(newImage maskAtX:x y:y) == 0 ifTrue:[ |
|
2569 |
newImage pixelAtX:x y:y put:0 |
|
2570 |
] |
|
2571 |
] |
|
2572 |
]. |
|
2573 |
||
1403 | 2574 |
(imageEditView image:newImage) notNil ifTrue:[ |
1446 | 2575 |
self fetchImageData. |
1403 | 2576 |
] |
2577 |
] |
|
2578 |
! |
|
2579 |
||
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2580 |
colorMapChanged |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2581 |
|img| |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2582 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2583 |
img := self image. |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2584 |
img release. |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2585 |
|
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2586 |
self imageEditView invalidate. |
960 | 2587 |
self imagePreView invalidate. |
2588 |
||
2589 |
"/ (imageEditView image:img) notNil ifTrue:[ |
|
2590 |
"/ self updateLabelsAndHistory. |
|
2591 |
"/ self imagePreView image:img |
|
2592 |
"/ ] |
|
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2593 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2594 |
"Created: / 7.8.1998 / 22:26:10 / cg" |
960 | 2595 |
"Modified: / 18.8.1998 / 17:08:55 / cg" |
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2596 |
! |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2597 |
|
975 | 2598 |
colorMapMode:aMode |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2599 |
"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
|
2600 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2601 |
|depth numColors newColorMap newImage |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2602 |
oldImage image newColors realColorMap oldFileName |
1008 | 2603 |
usedColors useNearest usageCounts tmpBits tmpMap quest |
2604 |
prevMode maskThreshold maskImage| |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2605 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2606 |
self withExecuteCursorDo:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2607 |
oldImage := self image. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2608 |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2609 |
prevMode := colorMapMode value. |
1008 | 2610 |
oldImage depth > 8 ifTrue:[ |
2611 |
prevMode := nil |
|
2612 |
]. |
|
2613 |
||
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2614 |
newColorMap := self class listOfColorMaps at:aMode. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2615 |
depth := (newColorMap size log: 2) asInteger. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2616 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2617 |
useNearest := false. |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2618 |
depth == 1 ifTrue:[ |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2619 |
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
|
2620 |
] ifFalse:[ |
1008 | 2621 |
prevMode isNil ifTrue:[ |
2622 |
quest := 'Compute colormap (or use standard)' |
|
2623 |
] ifFalse:[ |
|
2624 |
quest := 'Keep colormap (or use standard)' |
|
2625 |
] |
|
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2626 |
]. |
1008 | 2627 |
((prevMode = aMode) |
1057 | 2628 |
or:[depth > oldImage depth |
2629 |
or:[self confirm:(resources string:quest)]]) ifTrue:[ |
|
1008 | 2630 |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2631 |
"/ keep the colormap |
1008 | 2632 |
newColorMap atAllPut:Color black. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2633 |
depth > oldImage depth ifTrue:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2634 |
"/ easy - simply copy the part |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2635 |
numColors := 1 bitShift:oldImage depth. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2636 |
0 to:numColors-1 do:[:pixel | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2637 |
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
|
2638 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2639 |
] ifFalse:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2640 |
"/ see if all used color fit the new colormap |
986 | 2641 |
usedColors := oldImage usedColorsMax:(1 bitShift:depth). |
1403 | 2642 |
(usedColors notNil and:[usedColors size > (1 bitShift:depth)]) ifTrue:[ |
2643 |
usedColors := oldImage realUsedColors |
|
2644 |
]. |
|
986 | 2645 |
(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
|
2646 |
"/ yea - just install them |
986 | 2647 |
usedColors asArray keysAndValuesDo:[:idx :clr | |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2648 |
newColorMap at:idx put:clr |
1008 | 2649 |
]. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2650 |
] ifFalse:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2651 |
"/ copy over those that are most often used. |
986 | 2652 |
oldImage depth < 8 ifTrue:[ |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2653 |
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
|
2654 |
oldImage bits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2655 |
expandPixels:(oldImage depth) |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2656 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2657 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2658 |
into:tmpBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2659 |
mapping:nil. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2660 |
] ifFalse:[ |
986 | 2661 |
oldImage depth == 8 ifTrue:[ |
2662 |
tmpBits := oldImage bits |
|
2663 |
] ifFalse:[ |
|
1124 | 2664 |
colorMapMode value:prevMode. |
1471 | 2665 |
self warn:('Too many used colors in image (', oldImage usedColors size printString , ').'). |
986 | 2666 |
^ self |
1471 | 2667 |
"/ (self confirm:('Too many used colors in image (', oldImage usedColors size printString , ').\\Dither ?' withCRs)) |
2668 |
"/ ifFalse:[. |
|
2669 |
"/ ^ self |
|
2670 |
"/ ]. |
|
2671 |
"/ self image: (Image newForDepth:depth) fromImage:oldImage. |
|
2672 |
"/ ^ self. |
|
986 | 2673 |
] |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2674 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2675 |
usageCounts := tmpBits usageCounts. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2676 |
tmpMap := Array new:usageCounts size. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2677 |
oldImage colorMap asArray keysAndValuesDo:[:i :clr | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2678 |
tmpMap at:i put:clr |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2679 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2680 |
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
|
2681 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2682 |
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
|
2683 |
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
|
2684 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2685 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2686 |
useNearest := Dialog |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2687 |
confirmWithCancel:(resources |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2688 |
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
|
2689 |
with:usedColors size |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2690 |
with:(1 bitShift:depth)) withCRs |
1542 | 2691 |
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
|
2692 |
useNearest isNil ifTrue:[ |
1542 | 2693 |
colorMapMode value:prevMode. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2694 |
^ self "/ cancel |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2695 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2696 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2697 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2698 |
] ifFalse:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2699 |
"/ standard colormap |
921
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2700 |
usedColors := oldImage usedColors. |
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2701 |
(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
|
2702 |
useNearest := Dialog |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2703 |
confirmWithCancel:(resources |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2704 |
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
|
2705 |
) withCRs |
1542 | 2706 |
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
|
2707 |
useNearest isNil ifTrue:[ |
1542 | 2708 |
colorMapMode value:prevMode. |
921
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2709 |
^ self "/ cancel |
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2710 |
]. |
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2711 |
]. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2712 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2713 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2714 |
imageEditView makeUndo. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2715 |
|
1424
d7367ae7f85e
fixed conversion of 3-3-2 8-bit truecolor images
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
2716 |
newImage := Image newForDepth:depth. |
d7367ae7f85e
fixed conversion of 3-3-2 8-bit truecolor images
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
2717 |
newImage depth:depth. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2718 |
oldFileName := oldImage fileName. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2719 |
|
1008 | 2720 |
Image imageErrorSignal handle:[:ex| |
2721 |
Color colorErrorSignal handle:[:ex| |
|
1542 | 2722 |
colorMapMode value:prevMode. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2723 |
imageEditView undo. |
1008 | 2724 |
^ self warn:(resources string:'Conversion failed !!') |
2725 |
] do:[ |
|
1393 | 2726 |
newImage := Image newForDepth:depth. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2727 |
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
|
2728 |
newImage colorMap:newColorMap. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2729 |
newImage photometric:#palette. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2730 |
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
|
2731 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2732 |
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
|
2733 |
[:x :y :clr | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2734 |
|newColor| |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2735 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2736 |
(newColorMap includes:clr) |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2737 |
ifTrue: [newColor := clr] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2738 |
ifFalse: [ |
1008 | 2739 |
newColor := clr nearestIn:newColorMap. |
2740 |
useNearest ifFalse:[ |
|
2741 |
(newColor deltaFrom:clr) > 0.5 ifTrue:[ |
|
2742 |
newColor := oldImage colorFromValue:0 |
|
2743 |
] |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2744 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2745 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2746 |
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
|
2747 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2748 |
image := newImage |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2749 |
]. |
1008 | 2750 |
] do:[ |
2751 |
image := newImage fromImage:oldImage |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2752 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2753 |
|
1008 | 2754 |
(aMode asString endsWith:'mask') ifTrue:[ |
2755 |
image mask isNil ifTrue:[ |
|
2756 |
(self confirm:'Generate mask from black ?') ifTrue:[ |
|
2757 |
maskThreshold := 0.1. |
|
2758 |
maskImage := Depth1Image fromImage:(image asThresholdMonochromeImage:maskThreshold). |
|
2759 |
] ifFalse:[ |
|
2760 |
maskImage := Depth1Image extent:image extent. |
|
2761 |
maskImage data:(ByteArray |
|
2762 |
new:(maskImage bytesPerRow * maskImage height) |
|
2763 |
withAll:16rFF). |
|
2764 |
||
2765 |
"/ maskImage fillRectangle:(image bounds) withColor:(Color colorId:1). |
|
2766 |
]. |
|
2767 |
image mask:maskImage. |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2768 |
]. |
1008 | 2769 |
] ifFalse:[ |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2770 |
image mask: nil. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2771 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2772 |
realColorMap := OrderedCollection new. |
1054 | 2773 |
image realColorMap do:[:clr| |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2774 |
(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
|
2775 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2776 |
newColors := realColorMap copyFrom: 1 to: (newColorMap size min: realColorMap size). |
1054 | 2777 |
newColorMap do:[:clr| |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2778 |
((newColors size < newColorMap size) and: [(newColors includes: clr) not]) |
1054 | 2779 |
ifTrue:[ |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2780 |
newColors add: clr |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2781 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2782 |
]. |
975 | 2783 |
image colorMap: newColors. |
1446 | 2784 |
image fileName: oldFileName. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2785 |
|
1054 | 2786 |
(imageEditView image: image) notNil ifTrue:[ |
1446 | 2787 |
self fetchImageData. |
2788 |
"/ self listOfColors contents: image colorMap. |
|
2789 |
"/ self findColorMapMode. |
|
2790 |
"/ self updateLabelsAndHistory. |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2791 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2792 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2793 |
|
1057 | 2794 |
"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
|
2795 |
! |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2796 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2797 |
compressColorMap |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2798 |
"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
|
2799 |
|
927 | 2800 |
|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
|
2801 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2802 |
oldImage := self image. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2803 |
depth := oldImage depth. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2804 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2805 |
oldImage photometric ~~ #palette ifTrue:[ |
930 | 2806 |
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
|
2807 |
^ self |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2808 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2809 |
|
1403 | 2810 |
usedColors := oldImage realUsedColors. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2811 |
usedColors size == (1 bitShift:depth) ifTrue:[ |
930 | 2812 |
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
|
2813 |
^ self |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2814 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2815 |
usedColors size == oldImage colorMap size ifTrue:[ |
930 | 2816 |
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
|
2817 |
^ self |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2818 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2819 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2820 |
imageEditView makeUndo. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2821 |
|
930 | 2822 |
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
|
2823 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2824 |
self withExecuteCursorDo:[ |
996
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2825 |
"/ newColorMap := Array new:usedColors size. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2826 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2827 |
"/ translation table |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2828 |
oldToNew := ByteArray new:(1 bitShift:depth). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2829 |
newColorMap := usedColors asArray. |
996
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2830 |
newColorMap sort:[:a :b | |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2831 |
a redByte == b redByte ifTrue:[ |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2832 |
a greenByte == b greenByte ifTrue:[ |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2833 |
a blueByte < b blueByte |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2834 |
] ifFalse:[ |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2835 |
a greenByte < b greenByte |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2836 |
] |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2837 |
] ifFalse:[ |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2838 |
a redByte < b redByte |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2839 |
] |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2840 |
]. |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2841 |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2842 |
oldImage colorMap asArray keysAndValuesDo:[:oldIdx :clr | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2843 |
|newPixel| |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2844 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2845 |
(usedColors includes:clr) ifTrue:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2846 |
newPixel := newColorMap indexOf:clr. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2847 |
oldToNew at:oldIdx put:newPixel-1. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2848 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2849 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2850 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2851 |
oldBits := oldImage bits. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2852 |
newBits := ByteArray new:(oldBits size). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2853 |
depth ~~ 8 ifTrue:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2854 |
"/ expand/compress can only handle 8bits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2855 |
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
|
2856 |
oldBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2857 |
expandPixels:depth |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2858 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2859 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2860 |
into:tmpBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2861 |
mapping:oldToNew. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2862 |
tmpBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2863 |
compressPixels:depth |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2864 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2865 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2866 |
into:newBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2867 |
mapping:nil |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2868 |
] ifFalse:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2869 |
oldBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2870 |
expandPixels:depth |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2871 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2872 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2873 |
into:newBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2874 |
mapping:oldToNew. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2875 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2876 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2877 |
newImage := oldImage species new |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2878 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2879 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2880 |
depth:depth |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2881 |
fromArray:newBits. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2882 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2883 |
newImage colorMap:newColorMap. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2884 |
newImage fileName:oldImage fileName. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2885 |
newImage mask:(oldImage mask copy). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2886 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2887 |
(imageEditView image:newImage) notNil ifTrue: |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2888 |
[ |
1446 | 2889 |
self fetchImageData. |
2890 |
"/ self listOfColors contents: newImage colorMap. |
|
2891 |
"/ self findColorMapMode. |
|
2892 |
"/ self updateLabelsAndHistory. |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2893 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2894 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2895 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2896 |
"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
|
2897 |
"Modified: / 15.9.1998 / 17:53:32 / cg" |
1008 | 2898 |
! |
2899 |
||
1480 | 2900 |
copyMask |
2901 |
|mask| |
|
2902 |
||
2903 |
mask := self image mask. |
|
2904 |
MaskClipboard := mask subImageIn: (0@0 extent:mask extent). |
|
2905 |
! |
|
2906 |
||
1446 | 2907 |
fetchImageData |
1460 | 2908 |
|image| |
2909 |
||
2910 |
(image := imageEditView image) notNil ifTrue:[ |
|
2911 |
self listOfColors contents:(image colorMap). |
|
2912 |
self findColorMapMode. |
|
2913 |
self updateLabelsAndHistory. |
|
2914 |
] |
|
1446 | 2915 |
! |
2916 |
||
1544 | 2917 |
inspectColor |
2918 |
| img clrIndex| |
|
2919 |
||
2920 |
img := self image. |
|
2921 |
img isNil ifTrue:[ |
|
2922 |
self warn:'No Image.'. |
|
2923 |
^ self |
|
2924 |
]. |
|
2925 |
clrIndex := self selectionOfColor value. |
|
2926 |
(img colorFromValue:clrIndex-1) inspect |
|
2927 |
! |
|
2928 |
||
1436 | 2929 |
makeGrayScale |
2930 |
|anyChange img| |
|
2931 |
||
2932 |
self withExecuteCursorDo:[ |
|
2933 |
anyChange := imageEditView makeGrayScale. |
|
2934 |
anyChange ifFalse:[ |
|
2935 |
Dialog warn:'Image unchanged'. |
|
2936 |
] ifTrue:[ |
|
2937 |
img := imageEditView image. |
|
2938 |
imageEditView image:img. |
|
1446 | 2939 |
self fetchImageData. |
1436 | 2940 |
] |
2941 |
]. |
|
2942 |
! |
|
2943 |
||
1446 | 2944 |
makeSelectedColorBrighter |
2945 |
|depth img cMap newColorMap newImage oldCListSize newMode clr| |
|
2946 |
||
2947 |
img := self image. |
|
2948 |
cMap := img colorMap. |
|
2949 |
cMap isNil ifTrue:[ |
|
2950 |
self warn:'Image has no colormap\change colorMap mode first.' withCRs. |
|
2951 |
^ self |
|
2952 |
]. |
|
2953 |
||
2954 |
imageEditView makeUndo. |
|
2955 |
||
2956 |
cMap := cMap asArray. |
|
2957 |
clr := cMap at:imageEditView selectedColorIndex. |
|
2958 |
cMap at:imageEditView selectedColorIndex put:clr lightened. |
|
2959 |
||
2960 |
newImage := img species new |
|
2961 |
width:img width |
|
2962 |
height:img height |
|
2963 |
depth:depth |
|
2964 |
fromArray:img bits. |
|
2965 |
||
2966 |
newImage colorMap:cMap. |
|
2967 |
newImage fileName:img fileName. |
|
2968 |
newImage mask:(img mask copy). |
|
2969 |
||
2970 |
(imageEditView image:newImage) notNil ifTrue:[ |
|
2971 |
self fetchImageData. |
|
2972 |
"/ self listOfColors contents: newImage colorMap. |
|
2973 |
"/ self findColorMapMode. |
|
2974 |
"/ self updateLabelsAndHistory. |
|
2975 |
] |
|
2976 |
||
2977 |
"Created: / 12.3.1999 / 00:20:28 / cg" |
|
2978 |
"Modified: / 16.3.1999 / 21:57:26 / cg" |
|
2979 |
! |
|
2980 |
||
2981 |
makeSelectedColorDarker |
|
1507 | 2982 |
|depth img cMap clr newImage| |
1446 | 2983 |
|
2984 |
img := self image. |
|
2985 |
cMap := img colorMap. |
|
2986 |
cMap isNil ifTrue:[ |
|
2987 |
self warn:'Image has no colormap\change colorMap mode first.' withCRs. |
|
2988 |
^ self |
|
2989 |
]. |
|
2990 |
imageEditView makeUndo. |
|
2991 |
||
2992 |
cMap := cMap asArray. |
|
2993 |
clr := cMap at:imageEditView selectedColorIndex. |
|
2994 |
cMap at:imageEditView selectedColorIndex put:clr darkened. |
|
2995 |
||
2996 |
newImage := img species new |
|
2997 |
width:img width |
|
2998 |
height:img height |
|
2999 |
depth:depth |
|
3000 |
fromArray:img bits. |
|
3001 |
||
3002 |
newImage colorMap:cMap. |
|
3003 |
newImage fileName:img fileName. |
|
3004 |
newImage mask:(img mask copy). |
|
3005 |
||
3006 |
(imageEditView image:newImage) notNil ifTrue:[ |
|
3007 |
self fetchImageData. |
|
3008 |
"/ self listOfColors contents: newImage colorMap. |
|
3009 |
"/ self findColorMapMode. |
|
3010 |
"/ self updateLabelsAndHistory. |
|
3011 |
] |
|
3012 |
||
3013 |
"Created: / 12.3.1999 / 00:20:28 / cg" |
|
3014 |
"Modified: / 16.3.1999 / 21:57:26 / cg" |
|
3015 |
! |
|
3016 |
||
1480 | 3017 |
pasteMask |
3018 |
|img mask| |
|
3019 |
||
3020 |
imageEditView makeUndo. |
|
3021 |
||
3022 |
img := self image. |
|
3023 |
mask := img mask. |
|
3024 |
||
3025 |
mask |
|
3026 |
copyFrom:MaskClipboard |
|
3027 |
x:0 y:0 |
|
3028 |
toX:0 y:0 |
|
3029 |
width:(mask width min:MaskClipboard width) |
|
3030 |
height:(mask height min:MaskClipboard height). |
|
3031 |
img mask:mask. |
|
3032 |
(imageEditView image:img copy) notNil ifTrue:[ |
|
3033 |
self fetchImageData. |
|
3034 |
] |
|
3035 |
! |
|
3036 |
||
1124 | 3037 |
reduceNumberOfColors |
3038 |
|s n anyChange img| |
|
3039 |
||
3040 |
s := Dialog request:'Number of color bits to strip (1-7) ?'. |
|
1435 | 3041 |
s size == 0 ifTrue:[^ self]. |
1124 | 3042 |
n := Integer readFrom:s onError:0. |
3043 |
(n between:1 and:7) ifFalse:[ |
|
3044 |
Dialog warn:'Image unchanged'. |
|
3045 |
^ self |
|
3046 |
]. |
|
3047 |
||
3048 |
self withExecuteCursorDo:[ |
|
3049 |
anyChange := imageEditView reduceColorResolutionBy:n. |
|
3050 |
anyChange ifFalse:[ |
|
3051 |
Dialog warn:'Image unchanged'. |
|
3052 |
] ifTrue:[ |
|
3053 |
img := imageEditView image. |
|
3054 |
imageEditView image:img. |
|
1446 | 3055 |
|
3056 |
self fetchImageData. |
|
3057 |
"/ self listOfColors contents:(img colorMap). |
|
3058 |
"/ self findColorMapMode. |
|
3059 |
"/ self updateLabelsAndHistory. |
|
1124 | 3060 |
Dialog information:(img usedColors size printString , ' colors used.') |
3061 |
] |
|
3062 |
]. |
|
3063 |
! |
|
3064 |
||
1008 | 3065 |
sortColorMap |
3066 |
"calculates a new color map for the image, sorting colors" |
|
3067 |
||
3068 |
|depth newColorMap newImage oldImage usedColors oldToNew oldBits newBits tmpBits| |
|
3069 |
||
3070 |
oldImage := self image. |
|
3071 |
depth := oldImage depth. |
|
3072 |
||
3073 |
oldImage photometric ~~ #palette ifTrue:[ |
|
3074 |
self information:'Compress colorMap: Only palette images have colormaps.'. |
|
3075 |
^ self |
|
3076 |
]. |
|
3077 |
||
3078 |
usedColors := oldImage realColorMap. |
|
3079 |
||
3080 |
imageEditView makeUndo. |
|
3081 |
||
3082 |
self withExecuteCursorDo:[ |
|
3083 |
"/ newColorMap := Array new:usedColors size. |
|
3084 |
||
3085 |
"/ translation table |
|
3086 |
oldToNew := ByteArray new:(1 bitShift:depth). |
|
3087 |
newColorMap := usedColors asArray. |
|
3088 |
newColorMap sort:[:a :b | |
|
3089 |
a redByte == b redByte ifTrue:[ |
|
3090 |
a greenByte == b greenByte ifTrue:[ |
|
3091 |
a blueByte < b blueByte |
|
3092 |
] ifFalse:[ |
|
3093 |
a greenByte < b greenByte |
|
3094 |
] |
|
3095 |
] ifFalse:[ |
|
3096 |
a redByte < b redByte |
|
3097 |
] |
|
3098 |
]. |
|
3099 |
||
3100 |
oldImage colorMap asArray keysAndValuesDo:[:oldIdx :clr | |
|
3101 |
|newPixel| |
|
3102 |
||
3103 |
(usedColors includes:clr) ifTrue:[ |
|
3104 |
newPixel := newColorMap indexOf:clr. |
|
3105 |
oldToNew at:oldIdx put:newPixel-1. |
|
3106 |
] |
|
3107 |
]. |
|
3108 |
||
3109 |
oldBits := oldImage bits. |
|
3110 |
newBits := ByteArray new:(oldBits size). |
|
3111 |
depth ~~ 8 ifTrue:[ |
|
3112 |
"/ expand/compress can only handle 8bits |
|
3113 |
tmpBits := ByteArray uninitializedNew:(oldImage width*oldImage height). |
|
3114 |
oldBits |
|
3115 |
expandPixels:depth |
|
3116 |
width:oldImage width |
|
3117 |
height:oldImage height |
|
3118 |
into:tmpBits |
|
3119 |
mapping:oldToNew. |
|
3120 |
tmpBits |
|
3121 |
compressPixels:depth |
|
3122 |
width:oldImage width |
|
3123 |
height:oldImage height |
|
3124 |
into:newBits |
|
3125 |
mapping:nil |
|
3126 |
] ifFalse:[ |
|
3127 |
oldBits |
|
3128 |
expandPixels:depth |
|
3129 |
width:oldImage width |
|
3130 |
height:oldImage height |
|
3131 |
into:newBits |
|
3132 |
mapping:oldToNew. |
|
3133 |
]. |
|
3134 |
||
3135 |
newImage := oldImage species new |
|
3136 |
width:oldImage width |
|
3137 |
height:oldImage height |
|
3138 |
depth:depth |
|
3139 |
fromArray:newBits. |
|
3140 |
||
3141 |
newImage colorMap:newColorMap. |
|
3142 |
newImage fileName:oldImage fileName. |
|
3143 |
newImage mask:(oldImage mask copy). |
|
3144 |
||
1054 | 3145 |
(imageEditView image:newImage) notNil ifTrue:[ |
1446 | 3146 |
self fetchImageData. |
3147 |
"/ self listOfColors contents: newImage colorMap. |
|
3148 |
"/ self findColorMapMode. |
|
3149 |
"/ self updateLabelsAndHistory. |
|
1008 | 3150 |
] |
3151 |
] |
|
3152 |
||
3153 |
"Modified: / 15.9.1998 / 17:53:32 / cg" |
|
3154 |
"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
|
3155 |
! ! |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
3156 |
|
400 | 3157 |
!ImageEditor methodsFor:'user actions - editing'! |
3158 |
||
767 | 3159 |
doBrowseClass |
3160 |
"opens a System Browser on the resourceClass and the resourceSelector" |
|
400 | 3161 |
|
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3162 |
|cls| |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3163 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3164 |
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
|
3165 |
cls isNil ifTrue:[^ self warn:'No Class specified']. |
1488 | 3166 |
UserPreferences systemBrowserClass |
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3167 |
openInClass:cls class |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3168 |
selector:(imageEditView resourceSelector) |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3169 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3170 |
"Modified: / 31.7.1998 / 02:01:15 / cg" |
400 | 3171 |
! |
3172 |
||
1045 | 3173 |
doCropAll |
986 | 3174 |
"find all borders and cut them off" |
3175 |
||
1045 | 3176 |
imageEditView cropLeft:true right:true top:true bottom:true. |
986 | 3177 |
self updateInfoLabel |
3178 |
||
3179 |
"Modified: / 7.9.1998 / 14:26:23 / cg" |
|
3180 |
"Created: / 7.9.1998 / 16:33:43 / cg" |
|
3181 |
! |
|
3182 |
||
1045 | 3183 |
doCropBottom |
986 | 3184 |
"find a bottom border and cut it off" |
3185 |
||
1045 | 3186 |
imageEditView cropLeft:false right:false top:false bottom:true. |
986 | 3187 |
self updateInfoLabel |
3188 |
||
3189 |
"Created: / 7.9.1998 / 13:00:20 / cg" |
|
3190 |
"Modified: / 7.9.1998 / 14:26:23 / cg" |
|
3191 |
! |
|
3192 |
||
1045 | 3193 |
doCropLeft |
986 | 3194 |
"find a left border and cut it off" |
3195 |
||
1045 | 3196 |
imageEditView cropLeft:true right:false top:false bottom:false. |
986 | 3197 |
self updateInfoLabel |
3198 |
||
3199 |
"Created: / 7.9.1998 / 13:00:14 / cg" |
|
3200 |
"Modified: / 7.9.1998 / 14:26:34 / cg" |
|
3201 |
! |
|
3202 |
||
1045 | 3203 |
doCropManual |
986 | 3204 |
"let user specify borders and cut them off" |
3205 |
||
1502 | 3206 |
|bindings left top right bottom img firstChange gropAction acceptChannel| |
3207 |
||
3208 |
acceptChannel := TriggerValue new. |
|
1490 | 3209 |
|
3210 |
firstChange := true. |
|
3211 |
||
1502 | 3212 |
gropAction := |
3213 |
[:lV :rV :tV :bV | |l r t b| |
|
3214 |
acceptChannel value:true. |
|
3215 |
||
3216 |
l := lV value. |
|
3217 |
r := rV value. |
|
3218 |
t := tV value. |
|
3219 |
b := bV value. |
|
3220 |
(l + r + t + b) == 0 ifTrue:[ |
|
3221 |
Screen current beep |
|
3222 |
] ifFalse:[ |
|
3223 |
img := imageEditView image. |
|
3224 |
firstChange ifTrue:[ |
|
3225 |
imageEditView makeUndo. |
|
3226 |
firstChange := false. |
|
3227 |
]. |
|
3228 |
imageEditView |
|
3229 |
makeSubImageX:l y:t |
|
3230 |
width:(img width - l - r) |
|
3231 |
height:(img height - t - b). |
|
3232 |
self updateInfoLabel |
|
3233 |
]. |
|
1490 | 3234 |
]. |
986 | 3235 |
|
3236 |
bindings := IdentityDictionary new. |
|
1507 | 3237 |
bindings at:#left put:(left := 1 asValue). |
3238 |
bindings at:#right put:(right := 1 asValue). |
|
3239 |
bindings at:#top put:(top := 1 asValue). |
|
3240 |
bindings at:#bottom put:(bottom := 1 asValue). |
|
1502 | 3241 |
bindings at:#acceptChannel put:acceptChannel. |
3242 |
||
3243 |
bindings at:#gropLeftNow put:[ gropAction value:left value:0 value:0 value:0 ]. |
|
3244 |
bindings at:#gropRightNow put:[ gropAction value:0 value:right value:0 value:0 ]. |
|
3245 |
bindings at:#gropTopNow put:[ gropAction value:0 value:0 value:top value:0 ]. |
|
3246 |
bindings at:#gropBottomNow put:[ gropAction value:0 value:0 value:0 value:bottom ]. |
|
3247 |
||
3248 |
bindings at:#applyAction put:[ gropAction value:left value:right value:top value:bottom ]. |
|
1490 | 3249 |
|
3250 |
(self openDialogInterface:#gropDialogSpec withBindings:bindings) |
|
1507 | 3251 |
ifFalse:[ |
3252 |
firstChange ~~ true ifTrue:[ |
|
3253 |
imageEditView undo |
|
3254 |
] |
|
3255 |
]. |
|
986 | 3256 |
|
3257 |
"Created: / 7.9.1998 / 18:16:07 / cg" |
|
3258 |
"Modified: / 7.9.1998 / 18:20:42 / cg" |
|
3259 |
! |
|
3260 |
||
1045 | 3261 |
doCropRight |
986 | 3262 |
"find a right border and cut it off" |
3263 |
||
1045 | 3264 |
imageEditView cropLeft:false right:true top:false bottom:false. |
986 | 3265 |
self updateInfoLabel |
3266 |
||
3267 |
"Created: / 7.9.1998 / 13:00:14 / cg" |
|
3268 |
"Modified: / 7.9.1998 / 14:26:44 / cg" |
|
3269 |
! |
|
3270 |
||
1045 | 3271 |
doCropTop |
986 | 3272 |
"find a top border and cut it off" |
3273 |
||
1045 | 3274 |
imageEditView cropLeft:false right:false top:true bottom:false. |
986 | 3275 |
self updateInfoLabel |
3276 |
||
3277 |
"Created: / 7.9.1998 / 13:00:19 / cg" |
|
3278 |
"Modified: / 7.9.1998 / 14:26:52 / cg" |
|
3279 |
! |
|
3280 |
||
1433 | 3281 |
doEditMask |
3282 |
"" |
|
3283 |
||
3284 |
self image mask edit |
|
3285 |
! |
|
3286 |
||
767 | 3287 |
doFlipHorizontal |
3288 |
"flips horizontally current image" |
|
400 | 3289 |
|
911 | 3290 |
imageEditView flipHorizontal |
400 | 3291 |
! |
3292 |
||
767 | 3293 |
doFlipVertical |
3294 |
"flips vertically current image" |
|
400 | 3295 |
|
911 | 3296 |
imageEditView flipVertical |
400 | 3297 |
! |
3298 |
||
767 | 3299 |
doMagnifyDown |
3300 |
"magnifies current image one step down" |
|
400 | 3301 |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3302 |
|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
|
3303 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3304 |
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
|
3305 |
(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
|
3306 |
magHolder value: mag - 1 |
400 | 3307 |
] |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3308 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3309 |
"Modified: / 26.7.1998 / 20:24:08 / cg" |
400 | 3310 |
! |
3311 |
||
767 | 3312 |
doMagnifyImage |
1479 | 3313 |
"magnifies the current image to a new size" |
400 | 3314 |
|
1353 | 3315 |
|box newSize image| |
3316 |
||
3317 |
image := imageEditView image. |
|
3318 |
||
3319 |
box := EnterBox new. |
|
3320 |
box title:(resources string:'Images new size:'). |
|
3321 |
box okText:(resources string:'OK'). |
|
3322 |
box abortText:(resources string:'Cancel'). |
|
3323 |
box initialText:image extent printString. |
|
3324 |
box showAtPointer. |
|
3325 |
(box accepted |
|
3326 |
and: [(newSize := Object readFromString:(box contents) onError:nil) notNil]) |
|
3327 |
ifTrue:[ |
|
1479 | 3328 |
newSize isPoint ifFalse:[ |
3329 |
self warn:'please enter the new size as ''x @ y''.'. |
|
3330 |
^ self. |
|
3331 |
]. |
|
3332 |
imageEditView magnifyImageTo:newSize. |
|
3333 |
]. |
|
3334 |
||
3335 |
self updateInfoLabel |
|
3336 |
! |
|
3337 |
||
3338 |
doMagnifyImageBy |
|
3339 |
"magnifies the current image (by a scale)" |
|
3340 |
||
3341 |
|box oldSize newSize scale image| |
|
3342 |
||
3343 |
image := imageEditView image. |
|
3344 |
oldSize := image extent. |
|
3345 |
||
3346 |
box := EnterBox new. |
|
3347 |
box title:(resources string:'Scale factor (<1 to shrink; >1 to magnify):'). |
|
3348 |
box okText:(resources string:'OK'). |
|
3349 |
box abortText:(resources string:'Cancel'). |
|
3350 |
box initialText:1 printString. |
|
3351 |
box showAtPointer. |
|
3352 |
||
3353 |
(box accepted |
|
3354 |
and: [(scale := Object readFromString:(box contents) onError:nil) notNil]) |
|
3355 |
ifTrue:[ |
|
3356 |
scale isNumber ifFalse:[ |
|
3357 |
self warn:'please enter a scale factor (<1 to shrink; >1 to magnify).'. |
|
3358 |
^ self. |
|
3359 |
]. |
|
3360 |
newSize := oldSize * scale. |
|
1353 | 3361 |
imageEditView magnifyImageTo:newSize. |
3362 |
]. |
|
3363 |
||
400 | 3364 |
self updateInfoLabel |
3365 |
! |
|
3366 |
||
767 | 3367 |
doMagnifyUp |
3368 |
"magnifies current image one step up" |
|
400 | 3369 |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3370 |
|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
|
3371 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3372 |
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
|
3373 |
(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
|
3374 |
magHolder value: mag + 1 |
400 | 3375 |
] |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3376 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3377 |
"Modified: / 26.7.1998 / 20:23:52 / cg" |
400 | 3378 |
! |
3379 |
||
767 | 3380 |
doNegativeImage |
3381 |
"negates current image by negating the color map" |
|
400 | 3382 |
|
911 | 3383 |
imageEditView negativeImage. |
400 | 3384 |
self listOfColors removeAll. |
901 | 3385 |
self findColorMapMode. |
911 | 3386 |
imageEditView undoImages removeLast |
400 | 3387 |
! |
3388 |
||
767 | 3389 |
doResizeImage |
1353 | 3390 |
"resizes the current image" |
3391 |
||
3392 |
|box newSize image| |
|
3393 |
||
3394 |
image := imageEditView image. |
|
3395 |
||
3396 |
box := EnterBox new. |
|
3397 |
box title:(resources string:'Images new size:'). |
|
3398 |
box okText:(resources string:'OK'). |
|
3399 |
box abortText:(resources string:'Cancel'). |
|
3400 |
box initialText:image extent printString. |
|
3401 |
box showAtPointer. |
|
3402 |
(box accepted |
|
3403 |
and: [(newSize := Object readFromString:(box contents) onError:nil) notNil]) |
|
3404 |
ifTrue:[ |
|
3405 |
imageEditView resizeImageTo:newSize. |
|
3406 |
]. |
|
3407 |
||
400 | 3408 |
! |
3409 |
||
767 | 3410 |
doRotateImage |
3411 |
"rotates current image" |
|
400 | 3412 |
|
1353 | 3413 |
|box rotation| |
3414 |
||
3415 |
box := EnterBox new. |
|
3416 |
box title:(resources string:'Rotate by (degrees, clockwise):'). |
|
3417 |
box okText:(resources string:'OK'). |
|
3418 |
box abortText:(resources string:'Cancel'). |
|
3419 |
box initialText: '0'. |
|
3420 |
box showAtPointer. |
|
3421 |
(box accepted and: [(rotation := Object readFromString: box contents onError:nil) notNil]) |
|
3422 |
ifTrue:[ |
|
3423 |
imageEditView rotateImageBy:rotation. |
|
3424 |
self updateInfoLabel |
|
3425 |
]. |
|
400 | 3426 |
! |
3427 |
||
1557 | 3428 |
doShiftManual |
3429 |
"let user specify amount and shift" |
|
3430 |
||
3431 |
|bindings amount img firstChange shiftAction acceptChannel| |
|
3432 |
||
3433 |
acceptChannel := TriggerValue new. |
|
3434 |
||
3435 |
firstChange := true. |
|
3436 |
||
3437 |
shiftAction := |
|
3438 |
[:shiftH :shiftV | |
|
3439 |
acceptChannel value:true. |
|
3440 |
||
3441 |
img := imageEditView image. |
|
3442 |
firstChange ifTrue:[ |
|
3443 |
imageEditView makeUndo. |
|
3444 |
firstChange := false. |
|
3445 |
]. |
|
3446 |
imageEditView shiftImageHorizontal:shiftH value vertical:shiftV value. |
|
3447 |
self updateInfoLabel |
|
3448 |
]. |
|
3449 |
||
3450 |
bindings := IdentityDictionary new. |
|
3451 |
bindings at:#shiftAmount put:(amount := 1 asValue). |
|
3452 |
bindings at:#acceptChannel put:acceptChannel. |
|
3453 |
||
3454 |
bindings at:#shiftLeftNow put:[ shiftAction value:(-1*amount value) value:0 ]. |
|
3455 |
bindings at:#shiftRightNow put:[ shiftAction value:amount value value:0 ]. |
|
3456 |
bindings at:#shiftUpNow put:[ shiftAction value:0 value:(-1*amount value) ]. |
|
3457 |
bindings at:#shiftDownNow put:[ shiftAction value:0 value:amount value ]. |
|
3458 |
||
3459 |
(self openDialogInterface:#shiftDialogSpec withBindings:bindings) |
|
3460 |
ifFalse:[ |
|
3461 |
firstChange ~~ true ifTrue:[ |
|
3462 |
imageEditView undo |
|
3463 |
] |
|
3464 |
]. |
|
3465 |
||
3466 |
"Created: / 7.9.1998 / 18:16:07 / cg" |
|
3467 |
"Modified: / 7.9.1998 / 18:20:42 / cg" |
|
3468 |
! |
|
3469 |
||
1480 | 3470 |
doUnCropManual |
3471 |
"let user specify borders and add them" |
|
3472 |
||
3473 |
|bindings left top right bottom img| |
|
3474 |
||
3475 |
bindings := IdentityDictionary new. |
|
3476 |
bindings at:#left put:(left := 0 asValue). |
|
3477 |
bindings at:#right put:(right := 0 asValue). |
|
3478 |
bindings at:#top put:(top := 0 asValue). |
|
3479 |
bindings at:#bottom put:(bottom := 0 asValue). |
|
3480 |
(self openDialogInterface:#ungropDialogSpec withBindings:bindings) |
|
3481 |
ifTrue:[ |
|
3482 |
left := left value. |
|
3483 |
right := right value. |
|
3484 |
top := top value. |
|
3485 |
bottom := bottom value. |
|
3486 |
img := imageEditView image. |
|
3487 |
||
3488 |
imageEditView |
|
3489 |
makeBorderedImageX:left y:top |
|
3490 |
width:(img width + left + right) |
|
3491 |
height:(img height + top + bottom). |
|
3492 |
self updateInfoLabel |
|
3493 |
]. |
|
3494 |
||
3495 |
"Created: / 7.9.1998 / 18:16:07 / cg" |
|
3496 |
"Modified: / 7.9.1998 / 18:20:42 / cg" |
|
3497 |
! |
|
3498 |
||
767 | 3499 |
doUndo |
3500 |
"reverses last edit action" |
|
400 | 3501 |
|
1436 | 3502 |
imageEditView undo. |
400 | 3503 |
! ! |
3504 |
||
3505 |
!ImageEditor methodsFor:'user actions - loading'! |
|
3506 |
||
767 | 3507 |
doLoadFromClass |
3508 |
"opens a dialog for loading an image from class and a (resource-) selector" |
|
400 | 3509 |
|
1122 | 3510 |
|img| |
3511 |
||
1054 | 3512 |
(imageEditView loadFromClass) notNil ifTrue:[ |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3513 |
imageSeqNr := nil. |
1122 | 3514 |
(img := self image) notNil ifTrue: [ |
3515 |
self listOfColors contents: img usedColors asSet asOrderedCollection. |
|
574 | 3516 |
self findColorMapMode. |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
3517 |
self updateLabelsAndHistory. |
1054 | 3518 |
] ifFalse: [ |
3519 |
self updateForNoImage |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
3520 |
]. |
449 | 3521 |
] |
400 | 3522 |
! |
3523 |
||
767 | 3524 |
doLoadFromFile |
3525 |
"opens a dialog for loading an image from a file" |
|
400 | 3526 |
|
1353 | 3527 |
|img file dir filters| |
3528 |
||
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3529 |
imageSeqNr := nil. |
1353 | 3530 |
img := self image. |
3531 |
img notNil ifTrue: [ |
|
3532 |
file := img fileName |
|
3533 |
] ifFalse:[ |
|
3534 |
dir := LastDirectory |
|
3535 |
]. |
|
3536 |
||
3537 |
filters := FileSelectionBrowser loadImageFileNameFilters. |
|
3538 |
||
3539 |
file notNil ifTrue:[ |
|
3540 |
file := FileSelectionBrowser |
|
3541 |
request:'Load Image From' |
|
3542 |
fileName:file |
|
3543 |
withFileFilters:filters. |
|
3544 |
] ifFalse:[ |
|
3545 |
file := FileSelectionBrowser |
|
3546 |
request:'Load Image From' |
|
3547 |
inDirectory:dir |
|
3548 |
withFileFilters:filters. |
|
3549 |
]. |
|
3550 |
file notNil ifTrue:[ |
|
3551 |
LastDirectory := file asFilename directoryName. |
|
3552 |
self loadFromFile:file |
|
3553 |
] |
|
400 | 3554 |
! |
3555 |
||
767 | 3556 |
doNewImage |
3557 |
"opens a dialog with choices of size and color map for creating a new image" |
|
400 | 3558 |
|
1383 | 3559 |
|aspects width height cMap imageClass image szString| |
3560 |
||
767 | 3561 |
|
400 | 3562 |
aspects := IdentityDictionary new |
767 | 3563 |
at:#listOfSizes put: self class listOfDefaultSizes asValue; |
3564 |
at:#listOfColorMaps put: self class listOfColorMaps keys asSortedCollection asValue; |
|
3565 |
at:#selectionOfSize put: self class listOfDefaultSizes first copy asValue; |
|
400 | 3566 |
at:#selectionOfColorMap put: self class listOfColorMaps keys asSortedCollection first asValue; |
3567 |
yourself. |
|
3568 |
||
767 | 3569 |
(self openDialogInterface:#dialogSpecForNewImage withBindings:aspects) |
1383 | 3570 |
ifTrue:[ |
3571 |
szString := (aspects at:#selectionOfSize) value. |
|
3572 |
width := 128 min: (Integer readFromString: (szString upTo: $x) onError:[24]). |
|
3573 |
height := 128 min: (Integer readFromString: (szString copy reverse upTo: $x) reverse onError:[24]). |
|
400 | 3574 |
|
975 | 3575 |
cMap := (self class listOfColorMaps at: (colorMapMode value: (aspects at:#selectionOfColorMap) value) value). |
400 | 3576 |
imageClass := Image implementorForDepth: ((cMap size log: 2) asInteger). |
767 | 3577 |
image := imageClass width: width height: height fromArray: (ByteArray new: width*height). |
400 | 3578 |
|
975 | 3579 |
(colorMapMode value endsWith: 'mask') |
400 | 3580 |
ifTrue: |
3581 |
[ |
|
767 | 3582 |
image mask: (Depth1Image width: width height: height depth: 1 fromArray: (ByteArray new: width*height)) clearMaskedPixels |
400 | 3583 |
]. |
3584 |
image colorMap: cMap. |
|
3585 |
image fillRectangleX:0 y:0 width:width height:height with:Color white. |
|
911 | 3586 |
(imageEditView image: image) notNil |
400 | 3587 |
ifTrue: |
3588 |
[ |
|
3589 |
self listOfColors contents: cMap. |
|
3590 |
self findColorMapMode. |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
3591 |
self updateLabelsAndHistory. |
400 | 3592 |
] |
767 | 3593 |
] |
929 | 3594 |
! |
3595 |
||
3596 |
grabScreenImage |
|
3597 |
"let user choose an area and grab that are for editing" |
|
3598 |
||
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
3599 |
Processor |
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
3600 |
addTimedBlock:[ |
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
3601 |
|image d8image img| |
929 | 3602 |
|
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3603 |
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
|
3604 |
image := Image fromUser. |
1121 | 3605 |
image isNil ifFalse:[ |
3606 |
image depth > 8 ifTrue:[ |
|
1122 | 3607 |
Object errorSignal handle:[:ex | |sig| |
1537
e86a686eeba2
class based exceptions - no longer need to send #haltSÃgnal
Claus Gittinger <cg@exept.de>
parents:
1507
diff
changeset
|
3608 |
(sig := ex signal) == HaltInterrupt ifTrue:[ex reject]. |
1122 | 3609 |
sig == Signal noHandlerSignal ifTrue:[ex reject]. |
1121 | 3610 |
|
3611 |
self warn:'Could not convert to depth8 image (too many colors)'. |
|
3612 |
d8image := nil. |
|
3613 |
] do:[ |
|
3614 |
d8image := Depth8Image new. |
|
3615 |
d8image fromImage:image. |
|
3616 |
]. |
|
3617 |
d8image notNil ifTrue:[ |
|
3618 |
image := d8image |
|
3619 |
] |
|
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
3620 |
]. |
1121 | 3621 |
(imageEditView image:image) notNil ifTrue:[ |
3622 |
self listOfColors contents:(image colorMap). |
|
3623 |
self findColorMapMode. |
|
3624 |
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
|
3625 |
] |
1121 | 3626 |
] |
3627 |
] |
|
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
3628 |
afterSeconds:1 |
929 | 3629 |
|
3630 |
"Created: / 29.7.1998 / 21:24:42 / cg" |
|
1537
e86a686eeba2
class based exceptions - no longer need to send #haltSÃgnal
Claus Gittinger <cg@exept.de>
parents:
1507
diff
changeset
|
3631 |
"Modified: / 16.11.2001 / 16:21:19 / cg" |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3632 |
! |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3633 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3634 |
nextImageInSequence |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3635 |
"display the next image in the image sequence" |
1383 | 3636 |
|img seq frame listOfColors| |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3637 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3638 |
imageEditView releaseUndos. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3639 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3640 |
seq := self image imageSequence. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3641 |
imageSeqNr isNil ifTrue:[ |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3642 |
imageSeqNr := 1. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3643 |
]. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3644 |
imageSeqNr := imageSeqNr + 1. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3645 |
imageSeqNr > seq size ifTrue:[ |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3646 |
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
|
3647 |
imageSeqNr := 1. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3648 |
]. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3649 |
frame := seq at:imageSeqNr. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3650 |
imageEditView image:(frame image). |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3651 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3652 |
(img := self image) notNil ifTrue:[ |
1383 | 3653 |
listOfColors := self listOfColors. |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3654 |
img colorMap notNil ifTrue:[ |
1383 | 3655 |
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
|
3656 |
] ifFalse:[ |
1383 | 3657 |
listOfColors removeAll. |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3658 |
]. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3659 |
self findColorMapMode. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3660 |
self updateLabelsAndHistory. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3661 |
img := img onDevice:device. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3662 |
imageEditView image:img. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3663 |
] ifFalse:[ |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3664 |
self updateForNoImage |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3665 |
]. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3666 |
|
400 | 3667 |
! ! |
3668 |
||
3669 |
!ImageEditor methodsFor:'user actions - saving'! |
|
3670 |
||
767 | 3671 |
doPrint |
3672 |
"prints current image on the current printer" |
|
400 | 3673 |
|
911 | 3674 |
imageEditView print |
400 | 3675 |
! |
3676 |
||
767 | 3677 |
doSaveImageFile |
3678 |
"saves current image to current file" |
|
400 | 3679 |
|
1481 | 3680 |
imageEditView save. |
400 | 3681 |
! |
3682 |
||
767 | 3683 |
doSaveImageFileAs |
3684 |
"opens a dialog for saving current image to a file" |
|
400 | 3685 |
|
911 | 3686 |
imageEditView saveImageFileAs. |
1481 | 3687 |
self updateLabelsAndHistory. |
400 | 3688 |
! |
3689 |
||
767 | 3690 |
doSaveImageMaskFileAs |
3691 |
"opens a dialog for saving mask of current image to a file" |
|
400 | 3692 |
|
1481 | 3693 |
imageEditView saveImageMaskFileAs. |
400 | 3694 |
! |
3695 |
||
767 | 3696 |
doSaveMethod |
3697 |
"saves current image on current class and selector" |
|
400 | 3698 |
|
911 | 3699 |
imageEditView saveMethod notNil |
400 | 3700 |
ifTrue: |
3701 |
[ |
|
694 | 3702 |
self updateLabelsAndHistory |
400 | 3703 |
] |
3704 |
! |
|
3705 |
||
767 | 3706 |
doSaveMethodAs |
3707 |
"opens a dialog for saving current image on a class and a selector" |
|
400 | 3708 |
|
911 | 3709 |
imageEditView saveMethodAs notNil |
400 | 3710 |
ifTrue: |
3711 |
[ |
|
694 | 3712 |
self updateLabelsAndHistory |
400 | 3713 |
] |
1309
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3714 |
! |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3715 |
|
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3716 |
doShowStoreString |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3717 |
"opens a dialog showing the storeString |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3718 |
(sometimes useful to embed an image into source code)" |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3719 |
|
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3720 |
|img| |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3721 |
|
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3722 |
img := imageEditView image. |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3723 |
TextBox openOn:img storeString |
400 | 3724 |
! ! |
3725 |
||
1353 | 3726 |
!ImageEditor methodsFor:'user actions - settings'! |
3727 |
||
3728 |
doChangeGridMagnification |
|
3729 |
"change grid magnification" |
|
3730 |
||
3731 |
|box oldGridLimit newGridLimit| |
|
3732 |
||
3733 |
oldGridLimit := imageEditView class gridMagnificationLimit asPoint. |
|
3734 |
||
3735 |
box := EnterBox new. |
|
3736 |
box title:(resources string:'Grid Magnification Limit:'). |
|
3737 |
box okText:(resources string:'OK'). |
|
3738 |
box abortText:(resources string:'Cancel'). |
|
3739 |
box initialText:(oldGridLimit x printString). |
|
3740 |
box showAtPointer. |
|
3741 |
||
3742 |
(box accepted |
|
3743 |
and: [(newGridLimit := Number readFromString:(box contents) onError:[2]) notNil] |
|
3744 |
) ifTrue:[ |
|
3745 |
newGridLimit := (99 min: (2 max:newGridLimit)) asPoint. |
|
3746 |
imageEditView class gridMagnificationLimit:newGridLimit. |
|
3747 |
imageEditView invalidate |
|
3748 |
] |
|
3749 |
||
3750 |
! ! |
|
3751 |
||
400 | 3752 |
!ImageEditor class methodsFor:'documentation'! |
3753 |
||
3754 |
version |
|
3755 |
^ '$Header$' |
|
3756 |
! ! |