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