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