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