400
|
1 |
"
|
503
|
2 |
COPYRIGHT (c) 1997 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 |
|
|
13 |
ToolApplicationModel subclass:#ImageEditor
|
|
14 |
instanceVariableNames:'colorMapMode selectedColorIndex postOpenAction'
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Interface-Advanced-Tools'
|
|
18 |
!
|
|
19 |
|
|
20 |
!ImageEditor class methodsFor:'documentation'!
|
|
21 |
|
|
22 |
copyright
|
|
23 |
"
|
503
|
24 |
COPYRIGHT (c) 1997 by eXept Software AG
|
400
|
25 |
All Rights Reserved
|
|
26 |
|
|
27 |
This software is furnished under a license and may be used
|
|
28 |
only in accordance with the terms of that license and with the
|
405
|
29 |
inclusion of the above copyright notice. This software may not
|
400
|
30 |
be provided or otherwise made available to, or used by, any
|
405
|
31 |
other person. No title to or ownership of the software is
|
400
|
32 |
hereby transferred.
|
|
33 |
"
|
|
34 |
!
|
|
35 |
|
|
36 |
documentation
|
|
37 |
"
|
|
38 |
By the Image Editor you are able to create, design, modify or just inspect images.
|
|
39 |
|
|
40 |
[start with:]
|
|
41 |
ImageEditor open
|
|
42 |
ImageEditor openOnClass:ImageEditor andSelector:#newImageIcon
|
|
43 |
|
|
44 |
[see also:]
|
|
45 |
ImageEditView Image
|
|
46 |
|
|
47 |
[author:]
|
|
48 |
Thomas Zwick
|
|
49 |
"
|
|
50 |
! !
|
|
51 |
|
|
52 |
!ImageEditor class methodsFor:'instance creation'!
|
|
53 |
|
|
54 |
openModalOnClass: aClass andSelector: aSelector
|
|
55 |
|
|
56 |
"self openModalOnClass: self andSelector: #newImageIcon"
|
|
57 |
|
415
|
58 |
|imageEditor className resourceClassName resourceSelector|
|
400
|
59 |
imageEditor := self new.
|
|
60 |
aClass isClass ifTrue: [className := aClass name].
|
|
61 |
aClass isString ifTrue: [className := aClass].
|
|
62 |
|
415
|
63 |
imageEditor postOpenAction: [imageEditor loadFromOrPrepareForMessage: className, ' ', aSelector].
|
400
|
64 |
imageEditor openModal.
|
|
65 |
|
|
66 |
resourceClassName := imageEditor valueOfResourceClass value.
|
|
67 |
resourceSelector := imageEditor valueOfResourceSelector value.
|
415
|
68 |
|
|
69 |
(className asString ~= resourceClassName) | (aSelector asString ~= resourceSelector)
|
|
70 |
ifTrue: [^resourceClassName, ' ', resourceSelector]
|
|
71 |
ifFalse:[^nil]
|
400
|
72 |
!
|
|
73 |
|
|
74 |
openOnClass: aClass andSelector: aSelector
|
|
75 |
|
|
76 |
"self openOnClass: self andSelector: #newImageIcon"
|
|
77 |
|
|
78 |
^self open loadFromMessage: aClass name, ' ', aSelector
|
|
79 |
!
|
|
80 |
|
|
81 |
openOnFile: image
|
|
82 |
|
|
83 |
"self openOnFile: 'bitmaps/SmalltalkX.xbm'"
|
|
84 |
|
|
85 |
^self open loadFromFile: image
|
|
86 |
!
|
|
87 |
|
|
88 |
openOnImage: image
|
|
89 |
|
|
90 |
"self openOnImage: self stxIcon"
|
|
91 |
|
|
92 |
^self open loadFromImage: image
|
|
93 |
! !
|
|
94 |
|
|
95 |
!ImageEditor class methodsFor:'accessing'!
|
|
96 |
|
|
97 |
listOfColorMaps
|
|
98 |
|
|
99 |
|colorMap|
|
|
100 |
(colorMap := OrderedCollection new)
|
|
101 |
add: Color black;
|
|
102 |
add: Color white;
|
|
103 |
add: Color red;
|
|
104 |
add: Color green;
|
|
105 |
add: Color blue;
|
|
106 |
add: Color cyan;
|
|
107 |
add: Color yellow;
|
|
108 |
add: Color magenta;
|
|
109 |
add: (Color red: 50 green: 0 blue: 0);
|
|
110 |
add: (Color red: 0 green: 50 blue: 0);
|
|
111 |
add: (Color red: 0 green: 0 blue: 50);
|
|
112 |
add: (Color red: 0 green: 50 blue: 50);
|
|
113 |
add: (Color red: 50 green: 50 blue: 0);
|
|
114 |
add: (Color red: 50 green: 0 blue: 50);
|
|
115 |
add: Color gray;
|
|
116 |
add: Color lightGray.
|
|
117 |
0 to: 5 do:
|
|
118 |
[:r|
|
|
119 |
0 to: 5 do:
|
|
120 |
[:g|
|
|
121 |
0 to: 5 do:
|
|
122 |
[:b|
|
|
123 |
colorMap add: (Color red: (r*100//5) ceiling green: (g*100//5) ceiling blue: (b*100//5) ceiling)
|
|
124 |
]
|
|
125 |
]
|
|
126 |
].
|
|
127 |
|
|
128 |
1 to: 25 do:
|
|
129 |
[:g|
|
|
130 |
colorMap add: (Color gray: (g*100//26) ceiling)
|
|
131 |
].
|
|
132 |
|
|
133 |
^Dictionary new
|
|
134 |
at: '8-plane' put: colorMap;
|
|
135 |
at: '8-plane + mask' put: colorMap;
|
|
136 |
at: '4-plane' put: (colorMap copyFrom: 1 to: 16);
|
|
137 |
at: '4-plane + mask' put: (colorMap copyFrom: 1 to: 16);
|
|
138 |
at: '2-plane' put: (colorMap copyFrom: 1 to: 4);
|
|
139 |
at: '2-plane + mask' put: (colorMap copyFrom: 1 to: 4);
|
|
140 |
at: '1-plane' put: (colorMap copyFrom: 1 to: 2);
|
|
141 |
at: '1-plane + mask' put: (colorMap copyFrom: 1 to: 2);
|
|
142 |
yourself
|
|
143 |
!
|
|
144 |
|
|
145 |
listOfDefaultSizes
|
|
146 |
|
|
147 |
^#('24x24' '16x16' '32x32')
|
|
148 |
! !
|
|
149 |
|
460
|
150 |
!ImageEditor class methodsFor:'help specs'!
|
|
151 |
|
|
152 |
helpSpec
|
|
153 |
"return a dictionary filled with helpKey -> helptext associations.
|
|
154 |
These are used by the activeHelp tool."
|
|
155 |
|
|
156 |
"
|
|
157 |
UIHelpTool openOnClass:ImageEditor
|
|
158 |
"
|
|
159 |
|
|
160 |
^ super helpSpec addPairsFrom:#(
|
|
161 |
|
|
162 |
#colorMap
|
|
163 |
'Increases or reduces size of color map of the image.'
|
|
164 |
|
487
|
165 |
#colorMapTable
|
|
166 |
'Shows a list of used colors of the current image.'
|
|
167 |
|
460
|
168 |
#drawModeBox
|
|
169 |
'Switches to mode drawing boxes.'
|
|
170 |
|
|
171 |
#drawModeCopy
|
|
172 |
'Switches to mode copying areas.'
|
|
173 |
|
|
174 |
#drawModeFill
|
|
175 |
'Switches to mode filling areas around selected point.'
|
|
176 |
|
|
177 |
#drawModeFilledBox
|
|
178 |
'Switches to mode drawing filled boxes.'
|
|
179 |
|
|
180 |
#drawModePaste
|
|
181 |
'Switches to mode pasting areas at selected point.'
|
|
182 |
|
|
183 |
#drawModePoint
|
|
184 |
'Switches to mode drawing points.'
|
|
185 |
|
|
186 |
#editFlipHorizontal
|
|
187 |
'Flips horizontally the image.'
|
|
188 |
|
|
189 |
#editFlipVertical
|
|
190 |
'Flips vertically the image.'
|
|
191 |
|
|
192 |
#editMagnifyImage
|
|
193 |
'Opens a dialog to magnify the image.'
|
|
194 |
|
|
195 |
#editNegate
|
|
196 |
'Convertes colors of image by negating them.'
|
|
197 |
|
|
198 |
#editResize
|
|
199 |
'Opens a dialog to resize the image with preserving the old image.'
|
|
200 |
|
|
201 |
#editRotate
|
|
202 |
'Opens a dialog to rotate the image in degrees.'
|
|
203 |
|
|
204 |
#fileBrowseClass
|
|
205 |
'Opens the System Browser on the class and the selector.'
|
|
206 |
|
|
207 |
#fileLoadFromClass
|
|
208 |
'Opens a dialog for selecting an image resource method.'
|
|
209 |
|
|
210 |
#fileLoadFromClassWithSuperclass
|
|
211 |
'Opens a dialog for opening the resource dialog on a superclass.'
|
|
212 |
|
|
213 |
#fileLoadFromFile
|
|
214 |
'Opens a dialog for selecting an image file.'
|
|
215 |
|
|
216 |
#fileNewImage
|
|
217 |
'Opens a dialog with choices of size and color depth.'
|
|
218 |
|
|
219 |
#filePrint
|
|
220 |
'Print the image on a postscript printer.'
|
|
221 |
|
|
222 |
#fileSaveAs
|
|
223 |
'Opens dialog to save the image on a file.'
|
|
224 |
|
|
225 |
#fileSaveFile
|
|
226 |
'Saves the image on selected file name.'
|
|
227 |
|
|
228 |
#fileSaveMaskAs
|
|
229 |
'Opens dialog to save the mask of the image on a file.'
|
|
230 |
|
|
231 |
#fileSaveMethod
|
|
232 |
'Saves current image into selected class and selector.'
|
|
233 |
|
|
234 |
#fileSaveMethodAs
|
|
235 |
'Opens dialog to save the image on a class and a selector.'
|
|
236 |
|
|
237 |
#inputFieldFileName
|
|
238 |
'File name of the image.'
|
|
239 |
|
|
240 |
#inputFieldOfClass
|
|
241 |
'Class implementing the image method.'
|
|
242 |
|
|
243 |
#inputFieldOfSelector
|
|
244 |
'Selector of the class returning the image.'
|
|
245 |
|
487
|
246 |
#magnificationNumber
|
|
247 |
'Shows current number of magnification.'
|
|
248 |
|
|
249 |
#magnifyImageDown
|
|
250 |
'Magnifies down current image.'
|
|
251 |
|
|
252 |
#magnifyImageUp
|
|
253 |
'Magnifies up current image.'
|
|
254 |
|
|
255 |
#mouseKeyColorMode
|
|
256 |
'Toggles between left and right mouse key color.'
|
|
257 |
|
|
258 |
#previewView
|
|
259 |
'Shows preview of the current image.'
|
|
260 |
|
460
|
261 |
)
|
|
262 |
! !
|
|
263 |
|
400
|
264 |
!ImageEditor class methodsFor:'interface specs'!
|
|
265 |
|
519
|
266 |
windowSpec
|
|
267 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
268 |
|
|
269 |
"do not manually edit this - the painter/builder may not be able to
|
|
270 |
handle the specification if its corrupted."
|
|
271 |
|
|
272 |
"
|
|
273 |
UIPainter new openOnClass:ImageEditor andSelector:#windowSpec
|
|
274 |
ImageEditor new openInterface:#windowSpec
|
|
275 |
"
|
|
276 |
"ImageEditor open"
|
|
277 |
|
|
278 |
<resource: #canvas>
|
|
279 |
|
|
280 |
^
|
|
281 |
|
|
282 |
#(#FullSpec
|
|
283 |
#'window:'
|
|
284 |
#(#WindowSpec
|
|
285 |
#'name:' 'Image Editor'
|
|
286 |
#'layout:' #(#LayoutFrame 423 0 357 0 922 0 702 0)
|
|
287 |
#'label:' 'Image Editor'
|
|
288 |
#'min:' #(#Point 400 320)
|
|
289 |
#'max:' #(#Point 1152 900)
|
|
290 |
#'bounds:' #(#Rectangle 423 357 923 703)
|
|
291 |
#'menu:' #menu
|
|
292 |
#'usePreferredExtent:' false
|
|
293 |
)
|
|
294 |
#'component:'
|
|
295 |
#(#SpecCollection
|
|
296 |
#'collection:'
|
|
297 |
#(
|
|
298 |
#(#MenuPanelSpec
|
|
299 |
#'name:' 'menuToolbarView'
|
|
300 |
#'layout:' #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0)
|
|
301 |
#'menu:' #menuToolbar
|
|
302 |
#'style:' #(#FontDescription #helvetica #medium #roman 10)
|
|
303 |
#'showSeparatingLines:' true
|
|
304 |
)
|
|
305 |
#(#VariableHorizontalPanelSpec
|
|
306 |
#'name:' 'variableHorizontalPanel1'
|
|
307 |
#'layout:' #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -22 1.0)
|
|
308 |
#'component:'
|
|
309 |
#(#SpecCollection
|
|
310 |
#'collection:'
|
|
311 |
#(
|
|
312 |
#(#ViewSpec
|
|
313 |
#'name:' 'view1'
|
|
314 |
#'component:'
|
|
315 |
#(#SpecCollection
|
|
316 |
#'collection:'
|
|
317 |
#(
|
|
318 |
#(#FramedBoxSpec
|
|
319 |
#'name:' 'framedBox1'
|
|
320 |
#'layout:' #(#LayoutFrame 1 0.0 3 0.0 110 0 65 0)
|
|
321 |
#'component:'
|
|
322 |
#(#SpecCollection
|
|
323 |
#'collection:'
|
|
324 |
#(
|
|
325 |
#(#ArrowButtonSpec
|
|
326 |
#'name:' 'magnifyDownButton'
|
|
327 |
#'layout:' #(#LayoutFrame 13 0 20 0 35 0 42 0)
|
|
328 |
#'activeHelpKey:' #magnifyImageDown
|
|
329 |
#'model:' #magnifyDown
|
|
330 |
#'enableChannel:' #imageIsLoaded
|
|
331 |
#'isTriggerOnDown:' true
|
|
332 |
#'direction:' #left
|
|
333 |
)
|
|
334 |
#(#ArrowButtonSpec
|
|
335 |
#'name:' 'magnifyUpButton'
|
|
336 |
#'layout:' #(#LayoutFrame 73 0 20 0 95 0 42 0)
|
|
337 |
#'activeHelpKey:' #magnifyImageUp
|
|
338 |
#'model:' #magnifyUp
|
|
339 |
#'enableChannel:' #imageIsLoaded
|
|
340 |
#'isTriggerOnDown:' true
|
|
341 |
#'direction:' #right
|
|
342 |
)
|
|
343 |
#(#InputFieldSpec
|
|
344 |
#'name:' 'magnificationInputField'
|
|
345 |
#'layout:' #(#LayoutFrame 36 0 20 0.0 72 0 42 0)
|
|
346 |
#'activeHelpKey:' #magnificationNumber
|
|
347 |
#'enableChannel:' #imageIsLoaded
|
|
348 |
#'model:' #valueOfMagnification
|
|
349 |
#'type:' #number
|
|
350 |
#'acceptOnReturn:' false
|
|
351 |
#'acceptOnTab:' false
|
|
352 |
#'numChars:' 2
|
|
353 |
)
|
|
354 |
)
|
|
355 |
)
|
|
356 |
#'label:' 'Magnification'
|
|
357 |
#'labelPosition:' #topLeft
|
|
358 |
#'style:' #(#FontDescription #helvetica #medium #roman 12)
|
|
359 |
)
|
|
360 |
#(#ArbitraryComponentSpec
|
|
361 |
#'name:' 'imagePreView'
|
|
362 |
#'layout:' #(#LayoutFrame 111 0.0 9 0.0 -6 1 60 0)
|
|
363 |
#'activeHelpKey:' #previewView
|
|
364 |
#'hasHorizontalScrollBar:' true
|
|
365 |
#'hasVerticalScrollBar:' true
|
|
366 |
#'miniScrollerHorizontal:' true
|
|
367 |
#'miniScrollerVertical:' true
|
|
368 |
#'component:' #ImageView
|
|
369 |
#'hasBorder:' true
|
|
370 |
)
|
|
371 |
#(#FramedBoxSpec
|
|
372 |
#'name:' 'framedBox2'
|
|
373 |
#'layout:' #(#LayoutFrame 1 0.0 68 0 0 1.0 -66 1)
|
|
374 |
#'component:'
|
|
375 |
#(#SpecCollection
|
|
376 |
#'collection:'
|
|
377 |
#(
|
|
378 |
#(#DataSetSpec
|
|
379 |
#'name:' 'colorDataSetView'
|
|
380 |
#'layout:' #(#LayoutFrame 11 0.0 19 0.0 20 1.0 -10 1.0)
|
|
381 |
#'activeHelpKey:' #colorMapTable
|
|
382 |
#'model:' #selectionOfColor
|
|
383 |
#'style:' #(#FontDescription #helvetica #medium #roman 12)
|
|
384 |
#'hasHorizontalScrollBar:' true
|
|
385 |
#'hasVerticalScrollBar:' true
|
|
386 |
#'miniScrollerHorizontal:' true
|
|
387 |
#'miniScrollerVertical:' true
|
|
388 |
#'dataList:' #listOfColors
|
|
389 |
#'level:' -1
|
|
390 |
#'has3Dsepartors:' true
|
|
391 |
#'verticalSpacing:' 1
|
|
392 |
#'columns:'
|
|
393 |
#(
|
|
394 |
#(#DataSetColumnSpec
|
|
395 |
#'rendererType:' #rowSelector
|
|
396 |
#'backgroundSelector:' #yourself
|
|
397 |
)
|
|
398 |
#(#DataSetColumnSpec
|
|
399 |
#'label:' 'Red'
|
|
400 |
#'model:' #rowRedByte
|
|
401 |
#'canSelect:' false
|
|
402 |
)
|
|
403 |
#(#DataSetColumnSpec
|
|
404 |
#'label:' 'Green'
|
|
405 |
#'model:' #rowGreenByte
|
|
406 |
#'canSelect:' false
|
|
407 |
)
|
|
408 |
#(#DataSetColumnSpec
|
|
409 |
#'label:' 'Blue'
|
|
410 |
#'model:' #rowBlueByte
|
|
411 |
#'canSelect:' false
|
|
412 |
)
|
|
413 |
)
|
|
414 |
)
|
|
415 |
#(#MenuPanelSpec
|
|
416 |
#'name:' 'menuColorAssignmentPanel'
|
|
417 |
#'layout:' #(#LayoutFrame 11 0 -10 1 18 1 17 1)
|
|
418 |
#'activeHelpKey:' #mouseKeyColorMode
|
|
419 |
#'enableChannel:' #imageIsLoaded
|
|
420 |
#'menu:' #menuColorAssignment
|
|
421 |
#'style:' #(#FontDescription #helvetica #medium #roman 10)
|
|
422 |
)
|
|
423 |
)
|
|
424 |
)
|
|
425 |
#'label:' 'Color Map'
|
|
426 |
#'labelPosition:' #topLeft
|
|
427 |
#'style:' #(#FontDescription #helvetica #medium #roman 12)
|
|
428 |
)
|
|
429 |
#(#VerticalPanelViewSpec
|
|
430 |
#'name:' 'verticalPanelView1'
|
|
431 |
#'layout:' #(#LayoutFrame 1 0.0 -68 1 83 0 0 1.0)
|
|
432 |
#'component:'
|
|
433 |
#(#SpecCollection
|
|
434 |
#'collection:'
|
|
435 |
#(
|
|
436 |
#(#LabelSpec
|
|
437 |
#'name:' 'classNameLabel'
|
|
438 |
#'label:' 'Class:'
|
|
439 |
#'adjust:' #right
|
|
440 |
#'extent:' #(#Point 82 21)
|
|
441 |
)
|
|
442 |
#(#LabelSpec
|
|
443 |
#'name:' 'selectorLabel'
|
|
444 |
#'label:' 'Selector:'
|
|
445 |
#'adjust:' #right
|
|
446 |
#'extent:' #(#Point 82 20)
|
|
447 |
)
|
|
448 |
#(#LabelSpec
|
|
449 |
#'name:' 'fileNameLabel'
|
|
450 |
#'label:' 'File Name:'
|
|
451 |
#'adjust:' #right
|
|
452 |
#'extent:' #(#Point 82 21)
|
|
453 |
)
|
|
454 |
)
|
|
455 |
)
|
|
456 |
#'horizontalLayout:' #fit
|
|
457 |
#'verticalLayout:' #fit
|
|
458 |
#'horizontalSpace:' 3
|
|
459 |
#'verticalSpace:' 3
|
|
460 |
)
|
|
461 |
#(#VerticalPanelViewSpec
|
|
462 |
#'name:' 'verticalPanelView2'
|
|
463 |
#'layout:' #(#LayoutFrame 85 0.0 -68 1 -6 1 0 1.0)
|
|
464 |
#'component:'
|
|
465 |
#(#SpecCollection
|
|
466 |
#'collection:'
|
|
467 |
#(
|
|
468 |
#(#InputFieldSpec
|
|
469 |
#'name:' 'resourceClassInputField'
|
|
470 |
#'activeHelpKey:' #inputFieldOfClass
|
|
471 |
#'model:' #valueOfResourceClass
|
|
472 |
#'immediateAccept:' false
|
|
473 |
#'extent:' #(#Point 153 21)
|
|
474 |
)
|
|
475 |
#(#InputFieldSpec
|
|
476 |
#'name:' 'resourceSelectorInputField'
|
|
477 |
#'activeHelpKey:' #inputFieldOfSelector
|
|
478 |
#'model:' #valueOfResourceSelector
|
|
479 |
#'immediateAccept:' false
|
|
480 |
#'acceptOnTab:' false
|
|
481 |
#'extent:' #(#Point 153 20)
|
|
482 |
)
|
|
483 |
#(#InputFieldSpec
|
|
484 |
#'name:' 'fileNameInputField'
|
|
485 |
#'activeHelpKey:' #inputFieldFileName
|
|
486 |
#'model:' #valueOfFileName
|
|
487 |
#'immediateAccept:' false
|
|
488 |
#'acceptOnTab:' false
|
|
489 |
#'extent:' #(#Point 153 21)
|
|
490 |
)
|
|
491 |
)
|
|
492 |
)
|
|
493 |
#'horizontalLayout:' #fit
|
|
494 |
#'verticalLayout:' #fit
|
|
495 |
#'horizontalSpace:' 3
|
|
496 |
#'verticalSpace:' 3
|
|
497 |
)
|
|
498 |
)
|
|
499 |
)
|
|
500 |
#'level:' -1
|
|
501 |
)
|
|
502 |
#(#ViewSpec
|
|
503 |
#'name:' 'view2'
|
|
504 |
#'component:'
|
|
505 |
#(#SpecCollection
|
|
506 |
#'collection:'
|
|
507 |
#(
|
|
508 |
#(#ArbitraryComponentSpec
|
|
509 |
#'name:' 'imageEditView'
|
|
510 |
#'layout:' #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0)
|
|
511 |
#'hasHorizontalScrollBar:' true
|
|
512 |
#'hasVerticalScrollBar:' true
|
|
513 |
#'component:' #ImageEditView
|
|
514 |
#'hasBorder:' false
|
|
515 |
)
|
|
516 |
#(#LabelSpec
|
|
517 |
#'name:' 'coordLabel'
|
|
518 |
#'layout:' #(#LayoutFrame 2 0.0 -22 1 -4 1.0 0 1.0)
|
|
519 |
#'level:' -1
|
|
520 |
#'adjust:' #left
|
|
521 |
)
|
|
522 |
)
|
|
523 |
)
|
|
524 |
#'level:' -1
|
|
525 |
)
|
|
526 |
)
|
|
527 |
)
|
|
528 |
#'level:' 1
|
|
529 |
#'handles:' #(#Any 0.5 1.0)
|
|
530 |
)
|
|
531 |
#(#UISubSpecification
|
|
532 |
#'name:' 'infoBarSubSpec'
|
|
533 |
#'layout:' #(#LayoutFrame 0 0.0 -22 1 0 1.0 0 1.0)
|
|
534 |
#'majorKey:' #ToolApplicationModel
|
|
535 |
#'minorKey:' #windowSpecForInfoBar
|
|
536 |
)
|
|
537 |
)
|
|
538 |
)
|
|
539 |
)
|
|
540 |
!
|
|
541 |
|
|
542 |
windowSpecForNewImage
|
|
543 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
544 |
|
|
545 |
"do not manually edit this - the painter/builder may not be able to
|
|
546 |
handle the specification if its corrupted."
|
|
547 |
|
|
548 |
"
|
|
549 |
UIPainter new openOnClass:ImageEditor andSelector:#windowSpecForNewImage
|
|
550 |
ImageEditor new openInterface:#windowSpecForNewImage
|
|
551 |
"
|
|
552 |
|
|
553 |
<resource: #canvas>
|
|
554 |
|
|
555 |
^
|
|
556 |
|
|
557 |
#(#FullSpec
|
|
558 |
#'window:'
|
|
559 |
#(#WindowSpec
|
|
560 |
#'name:' 'New Image'
|
|
561 |
#'layout:' #(#LayoutFrame 194 0 152 0 461 0 248 0)
|
|
562 |
#'label:' 'New Image'
|
|
563 |
#'min:' #(#Point 10 10)
|
|
564 |
#'max:' #(#Point 1152 900)
|
|
565 |
#'bounds:' #(#Rectangle 194 152 462 249)
|
|
566 |
#'usePreferredExtent:' false
|
|
567 |
)
|
|
568 |
#'component:'
|
|
569 |
#(#SpecCollection
|
|
570 |
#'collection:'
|
|
571 |
#(
|
|
572 |
#(#ViewSpec
|
|
573 |
#'name:' 'View'
|
|
574 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -38 1.0)
|
|
575 |
#'component:'
|
|
576 |
#(#SpecCollection
|
|
577 |
#'collection:'
|
|
578 |
#(
|
|
579 |
#(#FramedBoxSpec
|
|
580 |
#'name:' 'framedBox1'
|
|
581 |
#'layout:' #(#LayoutFrame 1 0.0 1 0.0 0 0.4 55 0)
|
|
582 |
#'component:'
|
|
583 |
#(#SpecCollection
|
|
584 |
#'collection:'
|
|
585 |
#(
|
|
586 |
#(#ComboBoxSpec
|
|
587 |
#'name:' 'defaultSizesComboBox'
|
|
588 |
#'layout:' #(#LayoutFrame 15 0.0 16 0.0 15 1.0 16 1.0)
|
|
589 |
#'model:' #selectionOfSize
|
|
590 |
#'type:' #string
|
|
591 |
#'comboList:' #listOfDefaultSizes
|
|
592 |
)
|
|
593 |
)
|
|
594 |
)
|
|
595 |
#'label:' 'Size'
|
|
596 |
#'labelPosition:' #topLeft
|
|
597 |
#'style:' #(#FontDescription #helvetica #medium #roman 12)
|
|
598 |
)
|
|
599 |
#(#FramedBoxSpec
|
|
600 |
#'name:' 'framedBox2'
|
|
601 |
#'layout:' #(#LayoutFrame 0 0.4 1 0.0 -1 1.0 55 0)
|
|
602 |
#'component:'
|
|
603 |
#(#SpecCollection
|
|
604 |
#'collection:'
|
|
605 |
#(
|
|
606 |
#(#ComboListSpec
|
|
607 |
#'name:' 'colorMapComboBox'
|
|
608 |
#'layout:' #(#LayoutFrame 15 0.0 16 0.0 15 1.0 16 1.0)
|
|
609 |
#'model:' #selectionOfColorMap
|
|
610 |
#'comboList:' #listOfColorMaps
|
|
611 |
#'useIndex:' false
|
|
612 |
)
|
|
613 |
)
|
|
614 |
)
|
|
615 |
#'label:' 'Color Map'
|
|
616 |
#'labelPosition:' #topLeft
|
|
617 |
#'style:' #(#FontDescription #helvetica #medium #roman 12)
|
|
618 |
)
|
|
619 |
)
|
|
620 |
)
|
|
621 |
#'level:' 1
|
|
622 |
)
|
|
623 |
#(#HorizontalPanelViewSpec
|
|
624 |
#'name:' 'horizontalPanelView1'
|
|
625 |
#'layout:' #(#LayoutFrame 0 0.0 -38 1 0 1.0 0 1.0)
|
|
626 |
#'component:'
|
|
627 |
#(#SpecCollection
|
|
628 |
#'collection:'
|
|
629 |
#(
|
|
630 |
#(#ActionButtonSpec
|
|
631 |
#'name:' 'actionButton2'
|
|
632 |
#'label:' 'Cancel'
|
|
633 |
#'model:' #cancel
|
|
634 |
#'extent:' #(#Point 100 22)
|
|
635 |
)
|
|
636 |
#(#ActionButtonSpec
|
|
637 |
#'name:' 'actionButton1'
|
|
638 |
#'label:' 'OK'
|
|
639 |
#'model:' #accept
|
|
640 |
#'isDefault:' true
|
|
641 |
#'extent:' #(#Point 100 22)
|
|
642 |
)
|
|
643 |
)
|
|
644 |
)
|
|
645 |
#'horizontalLayout:' #center
|
|
646 |
#'verticalLayout:' #center
|
|
647 |
#'horizontalSpace:' 2
|
|
648 |
#'verticalSpace:' 1
|
|
649 |
)
|
|
650 |
)
|
|
651 |
)
|
|
652 |
)
|
|
653 |
! !
|
|
654 |
|
|
655 |
!ImageEditor class methodsFor:'menu specs'!
|
|
656 |
|
400
|
657 |
menu
|
|
658 |
"this window spec was automatically generated by the ST/X MenuEditor"
|
|
659 |
|
|
660 |
"do not manually edit this - the builder may not be able to
|
|
661 |
handle the specification if its corrupted."
|
|
662 |
|
|
663 |
"
|
|
664 |
MenuEditor new openOnClass:ImageEditor andSelector:#menu
|
|
665 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menu)) startUp
|
|
666 |
"
|
|
667 |
|
|
668 |
<resource: #menu>
|
|
669 |
|
|
670 |
^
|
|
671 |
|
|
672 |
#(#Menu
|
|
673 |
|
|
674 |
#(
|
|
675 |
#(#MenuItem
|
|
676 |
#'label:' 'About'
|
|
677 |
#'labelImage:' #(#ResourceRetriever #ImageEditor #icon)
|
|
678 |
#'submenuChannel:' #menuAbout
|
|
679 |
)
|
|
680 |
#(#MenuItem
|
|
681 |
#'label:' 'File'
|
|
682 |
#'translateLabel:' true
|
|
683 |
#'submenu:'
|
|
684 |
#(#Menu
|
|
685 |
|
|
686 |
#(
|
|
687 |
#(#MenuItem
|
|
688 |
#'label:' 'New...'
|
|
689 |
#'value:' #newImage
|
460
|
690 |
#'activeHelpKey:' #fileNewImage
|
400
|
691 |
)
|
|
692 |
#(#MenuItem
|
|
693 |
#'label:' '-'
|
|
694 |
)
|
|
695 |
#(#MenuItem
|
|
696 |
#'label:' 'Load From File...'
|
|
697 |
#'value:' #loadFromFile
|
460
|
698 |
#'activeHelpKey:' #fileLoadFromFile
|
400
|
699 |
)
|
|
700 |
#(#MenuItem
|
|
701 |
#'label:' 'Load From Class...'
|
|
702 |
#'value:' #loadFromClass
|
460
|
703 |
#'activeHelpKey:' #fileLoadFromClass
|
400
|
704 |
)
|
|
705 |
#(#MenuItem
|
|
706 |
#'label:' '-'
|
|
707 |
)
|
|
708 |
#(#MenuItem
|
|
709 |
#'label:' 'Save'
|
|
710 |
#'value:' #saveImageFile
|
460
|
711 |
#'activeHelpKey:' #fileSaveFile
|
400
|
712 |
#'enabled:' #imageIsLoaded
|
|
713 |
)
|
|
714 |
#(#MenuItem
|
|
715 |
#'label:' 'Save As...'
|
|
716 |
#'value:' #saveImageFileAs
|
460
|
717 |
#'activeHelpKey:' #fileSaveAs
|
400
|
718 |
#'enabled:' #imageIsLoaded
|
|
719 |
)
|
|
720 |
#(#MenuItem
|
|
721 |
#'label:' 'Save Mask As...'
|
|
722 |
#'value:' #saveImageMaskFileAs
|
460
|
723 |
#'activeHelpKey:' #fileSaveMaskAs
|
400
|
724 |
#'enabled:' #imageIsLoaded
|
|
725 |
)
|
|
726 |
#(#MenuItem
|
|
727 |
#'label:' '-'
|
|
728 |
)
|
|
729 |
#(#MenuItem
|
|
730 |
#'label:' 'Save Method'
|
|
731 |
#'value:' #saveMethod
|
460
|
732 |
#'activeHelpKey:' #fileSaveMethod
|
400
|
733 |
#'enabled:' #imageIsLoaded
|
|
734 |
)
|
|
735 |
#(#MenuItem
|
|
736 |
#'label:' 'Save Method As...'
|
|
737 |
#'value:' #saveMethodAs
|
460
|
738 |
#'activeHelpKey:' #fileSaveMethodAs
|
400
|
739 |
#'enabled:' #imageIsLoaded
|
|
740 |
)
|
|
741 |
#(#MenuItem
|
|
742 |
#'label:' '-'
|
|
743 |
)
|
|
744 |
#(#MenuItem
|
|
745 |
#'label:' 'Print'
|
|
746 |
#'value:' #print
|
460
|
747 |
#'activeHelpKey:' #filePrint
|
400
|
748 |
#'enabled:' #imageIsLoaded
|
|
749 |
)
|
|
750 |
#(#MenuItem
|
|
751 |
#'label:' '-'
|
|
752 |
)
|
|
753 |
#(#MenuItem
|
499
|
754 |
#'label:' 'Browse Image Class'
|
400
|
755 |
#'value:' #browseClass
|
460
|
756 |
#'activeHelpKey:' #fileBrowseClass
|
400
|
757 |
#'enabled:' #imageIsLoaded
|
|
758 |
)
|
|
759 |
#(#MenuItem
|
|
760 |
#'label:' '-'
|
|
761 |
)
|
|
762 |
#(#MenuItem
|
|
763 |
#'label:' 'Exit'
|
|
764 |
#'translateLabel:' true
|
|
765 |
#'value:' #closeRequest
|
460
|
766 |
#'activeHelpKey:' #fileExit
|
400
|
767 |
)
|
|
768 |
) nil
|
|
769 |
nil
|
|
770 |
)
|
|
771 |
)
|
|
772 |
#(#MenuItem
|
|
773 |
#'label:' 'Edit'
|
|
774 |
#'enabled:' #imageIsLoaded
|
|
775 |
#'submenu:'
|
|
776 |
#(#Menu
|
|
777 |
|
|
778 |
#(
|
|
779 |
#(#MenuItem
|
|
780 |
#'label:' 'Undo'
|
|
781 |
#'value:' #undo
|
460
|
782 |
#'activeHelpKey:' #editUndo
|
400
|
783 |
)
|
|
784 |
#(#MenuItem
|
|
785 |
#'label:' '-'
|
|
786 |
)
|
|
787 |
#(#MenuItem
|
|
788 |
#'label:' 'Flip - Vertical'
|
|
789 |
#'value:' #flipVertical
|
460
|
790 |
#'activeHelpKey:' #editFlipVertical
|
400
|
791 |
)
|
|
792 |
#(#MenuItem
|
|
793 |
#'label:' 'Flip - Horizontal'
|
|
794 |
#'value:' #flipHorizontal
|
460
|
795 |
#'activeHelpKey:' #editFlipHorizontal
|
400
|
796 |
)
|
|
797 |
#(#MenuItem
|
|
798 |
#'label:' '-'
|
|
799 |
)
|
|
800 |
#(#MenuItem
|
|
801 |
#'label:' 'Resize...'
|
|
802 |
#'value:' #resizeImage
|
460
|
803 |
#'activeHelpKey:' #editResize
|
400
|
804 |
)
|
|
805 |
#(#MenuItem
|
|
806 |
#'label:' 'Magnify...'
|
|
807 |
#'value:' #magnifyImage
|
460
|
808 |
#'activeHelpKey:' #editMagnifyImage
|
400
|
809 |
)
|
|
810 |
#(#MenuItem
|
|
811 |
#'label:' 'Rotate...'
|
|
812 |
#'value:' #rotateImage
|
460
|
813 |
#'activeHelpKey:' #editRotate
|
400
|
814 |
)
|
|
815 |
#(#MenuItem
|
|
816 |
#'label:' '-'
|
|
817 |
)
|
|
818 |
#(#MenuItem
|
|
819 |
#'label:' 'Negative'
|
|
820 |
#'value:' #negativeImage
|
460
|
821 |
#'activeHelpKey:' #editNegate
|
400
|
822 |
)
|
|
823 |
) nil
|
|
824 |
nil
|
|
825 |
)
|
|
826 |
)
|
|
827 |
#(#MenuItem
|
|
828 |
#'label:' 'Color Map'
|
|
829 |
#'enabled:' #imageIsLoaded
|
|
830 |
#'submenu:'
|
|
831 |
#(#Menu
|
|
832 |
|
|
833 |
#(
|
|
834 |
#(#MenuItem
|
|
835 |
#'label:' '8-Plane'
|
460
|
836 |
#'activeHelpKey:' #colorMap
|
400
|
837 |
#'argument:' '8-plane'
|
|
838 |
#'indication:' #'colorMapMode:value:'
|
|
839 |
)
|
|
840 |
#(#MenuItem
|
|
841 |
#'label:' '4-Plane'
|
460
|
842 |
#'activeHelpKey:' #colorMap
|
400
|
843 |
#'argument:' '4-plane'
|
|
844 |
#'indication:' #'colorMapMode:value:'
|
|
845 |
)
|
|
846 |
#(#MenuItem
|
|
847 |
#'label:' '2-Plane'
|
460
|
848 |
#'activeHelpKey:' #colorMap
|
400
|
849 |
#'argument:' '2-plane'
|
|
850 |
#'indication:' #'colorMapMode:value:'
|
|
851 |
)
|
|
852 |
#(#MenuItem
|
|
853 |
#'label:' '1-Plane'
|
460
|
854 |
#'activeHelpKey:' #colorMap
|
400
|
855 |
#'argument:' '1-plane'
|
|
856 |
#'indication:' #'colorMapMode:value:'
|
|
857 |
)
|
|
858 |
#(#MenuItem
|
|
859 |
#'label:' '-'
|
|
860 |
)
|
|
861 |
#(#MenuItem
|
|
862 |
#'label:' '8-Plane + Mask'
|
460
|
863 |
#'activeHelpKey:' #colorMap
|
400
|
864 |
#'argument:' '8-plane + mask'
|
|
865 |
#'indication:' #'colorMapMode:value:'
|
|
866 |
)
|
|
867 |
#(#MenuItem
|
|
868 |
#'label:' '4-Plane + Mask'
|
460
|
869 |
#'activeHelpKey:' #colorMap
|
400
|
870 |
#'argument:' '4-plane + mask'
|
|
871 |
#'indication:' #'colorMapMode:value:'
|
|
872 |
)
|
|
873 |
#(#MenuItem
|
|
874 |
#'label:' '2-Plane + Mask'
|
460
|
875 |
#'activeHelpKey:' #colorMap
|
400
|
876 |
#'argument:' '2-plane + mask'
|
|
877 |
#'indication:' #'colorMapMode:value:'
|
|
878 |
)
|
|
879 |
#(#MenuItem
|
|
880 |
#'label:' '1-Plane + Mask'
|
460
|
881 |
#'activeHelpKey:' #colorMap
|
400
|
882 |
#'argument:' '1-plane + mask'
|
|
883 |
#'indication:' #'colorMapMode:value:'
|
|
884 |
)
|
|
885 |
) nil
|
|
886 |
nil
|
|
887 |
)
|
|
888 |
)
|
|
889 |
#(#MenuItem
|
|
890 |
#'label:' 'History'
|
|
891 |
#'submenuChannel:' #menuHistory
|
|
892 |
)
|
|
893 |
#(#MenuItem
|
|
894 |
#'label:' 'Help'
|
|
895 |
#'submenuChannel:' #menuHelp
|
|
896 |
)
|
|
897 |
) nil
|
|
898 |
nil
|
|
899 |
)
|
|
900 |
!
|
|
901 |
|
|
902 |
menuColorAssignment
|
|
903 |
"this window spec was automatically generated by the ST/X MenuEditor"
|
|
904 |
|
|
905 |
"do not manually edit this - the builder may not be able to
|
|
906 |
handle the specification if its corrupted."
|
|
907 |
|
|
908 |
"
|
|
909 |
MenuEditor new openOnClass:ImageEditor andSelector:#menuColorAssignment
|
|
910 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menuColorAssignment)) startUp
|
|
911 |
"
|
|
912 |
|
|
913 |
<resource: #menu>
|
|
914 |
|
|
915 |
^
|
|
916 |
|
|
917 |
#(#Menu
|
|
918 |
|
|
919 |
#(
|
|
920 |
#(#MenuItem
|
|
921 |
#'label:' 'left'
|
|
922 |
#'nameKey:' #leftMouseKeyButton
|
|
923 |
#'argument:' '1'
|
|
924 |
#'labelImage:' #(#ResourceRetriever nil #leftMouseKeyIcon)
|
|
925 |
#'indication:' #'mouseKeyColorMode:value:'
|
|
926 |
)
|
|
927 |
#(#MenuItem
|
|
928 |
#'label:' 'right'
|
|
929 |
#'nameKey:' #rightMouseKeyButton
|
|
930 |
#'argument:' '2'
|
|
931 |
#'labelImage:' #(#ResourceRetriever nil #rightMouseKeyIcon)
|
|
932 |
#'indication:' #'mouseKeyColorMode:value:'
|
|
933 |
)
|
|
934 |
) nil
|
|
935 |
nil
|
|
936 |
)
|
|
937 |
!
|
|
938 |
|
|
939 |
menuToolbar
|
|
940 |
"this window spec was automatically generated by the ST/X MenuEditor"
|
|
941 |
|
|
942 |
"do not manually edit this - the builder may not be able to
|
|
943 |
handle the specification if its corrupted."
|
|
944 |
|
|
945 |
"
|
|
946 |
MenuEditor new openOnClass:ImageEditor andSelector:#menuToolbar
|
|
947 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menuToolbar)) startUp
|
|
948 |
"
|
|
949 |
|
|
950 |
<resource: #menu>
|
|
951 |
|
|
952 |
^
|
|
953 |
|
|
954 |
#(#Menu
|
|
955 |
|
|
956 |
#(
|
|
957 |
#(#MenuItem
|
|
958 |
#'label:' 'newImage'
|
|
959 |
#'isButton:' true
|
|
960 |
#'value:' #newImage
|
460
|
961 |
#'activeHelpKey:' #fileNewImage
|
400
|
962 |
#'labelImage:' #(#ResourceRetriever nil #newImageIcon)
|
|
963 |
)
|
|
964 |
#(#MenuItem
|
|
965 |
#'label:' 'loadFromClass'
|
|
966 |
#'isButton:' true
|
|
967 |
#'value:' #loadFromClass
|
460
|
968 |
#'activeHelpKey:' #fileLoadFromClass
|
400
|
969 |
#'labelImage:' #(#ResourceRetriever nil #loadFromClassIcon)
|
|
970 |
)
|
|
971 |
#(#MenuItem
|
|
972 |
#'label:' 'loadFromFile'
|
|
973 |
#'isButton:' true
|
|
974 |
#'value:' #loadFromFile
|
460
|
975 |
#'activeHelpKey:' #fileLoadFromFile
|
400
|
976 |
#'labelImage:' #(#ResourceRetriever nil #loadFromFileIcon)
|
|
977 |
)
|
|
978 |
#(#MenuItem
|
519
|
979 |
#'label:' ''
|
400
|
980 |
)
|
|
981 |
#(#MenuItem
|
|
982 |
#'label:' 'saveMethod'
|
|
983 |
#'isButton:' true
|
|
984 |
#'value:' #saveMethod
|
460
|
985 |
#'activeHelpKey:' #fileSaveMethod
|
400
|
986 |
#'enabled:' #imageIsLoaded
|
|
987 |
#'labelImage:' #(#ResourceRetriever nil #saveAsMethodIcon)
|
|
988 |
)
|
|
989 |
#(#MenuItem
|
|
990 |
#'label:' 'saveFile'
|
|
991 |
#'isButton:' true
|
|
992 |
#'value:' #saveImageFile
|
460
|
993 |
#'activeHelpKey:' #fileSaveFile
|
400
|
994 |
#'enabled:' #imageIsLoaded
|
|
995 |
#'labelImage:' #(#ResourceRetriever nil #saveIcon)
|
|
996 |
)
|
|
997 |
#(#MenuItem
|
519
|
998 |
#'label:' ''
|
400
|
999 |
)
|
|
1000 |
#(#MenuItem
|
|
1001 |
#'label:' 'Point'
|
460
|
1002 |
#'activeHelpKey:' #drawModePoint
|
400
|
1003 |
#'enabled:' #imageIsLoaded
|
|
1004 |
#'argument:' 'point'
|
|
1005 |
#'indication:' #'editMode:value:'
|
|
1006 |
)
|
|
1007 |
#(#MenuItem
|
|
1008 |
#'label:' 'Box'
|
460
|
1009 |
#'activeHelpKey:' #drawModeBox
|
400
|
1010 |
#'enabled:' #imageIsLoaded
|
|
1011 |
#'argument:' 'box'
|
|
1012 |
#'indication:' #'editMode:value:'
|
|
1013 |
)
|
|
1014 |
#(#MenuItem
|
|
1015 |
#'label:' 'Filled Box'
|
460
|
1016 |
#'activeHelpKey:' #drawModeFilledBox
|
400
|
1017 |
#'enabled:' #imageIsLoaded
|
|
1018 |
#'argument:' 'filledBox'
|
|
1019 |
#'indication:' #'editMode:value:'
|
|
1020 |
)
|
|
1021 |
#(#MenuItem
|
|
1022 |
#'label:' 'Fill'
|
460
|
1023 |
#'activeHelpKey:' #drawModeFill
|
400
|
1024 |
#'enabled:' #imageIsLoaded
|
|
1025 |
#'argument:' 'fill'
|
|
1026 |
#'indication:' #'editMode:value:'
|
|
1027 |
)
|
|
1028 |
#(#MenuItem
|
|
1029 |
#'label:' 'Copy'
|
460
|
1030 |
#'activeHelpKey:' #drawModeCopy
|
400
|
1031 |
#'enabled:' #imageIsLoaded
|
|
1032 |
#'argument:' 'copy'
|
|
1033 |
#'indication:' #'editMode:value:'
|
|
1034 |
)
|
|
1035 |
#(#MenuItem
|
|
1036 |
#'label:' 'Paste'
|
460
|
1037 |
#'activeHelpKey:' #drawModePaste
|
400
|
1038 |
#'enabled:' #imageIsLoaded
|
|
1039 |
#'argument:' 'paste'
|
|
1040 |
#'indication:' #'editMode:value:'
|
|
1041 |
)
|
|
1042 |
) nil
|
|
1043 |
nil
|
|
1044 |
)
|
|
1045 |
! !
|
|
1046 |
|
|
1047 |
!ImageEditor class methodsFor:'resources'!
|
|
1048 |
|
|
1049 |
leftMouseKeyIcon
|
488
|
1050 |
"Generated by the Image Editor"
|
|
1051 |
"
|
|
1052 |
ImageEditor openOnClass:self andSelector:#leftMouseKeyIcon
|
|
1053 |
"
|
400
|
1054 |
|
|
1055 |
<resource: #image>
|
488
|
1056 |
|
|
1057 |
^Icon
|
|
1058 |
constantNamed:#'ImageEditor leftMouseKeyIcon'
|
|
1059 |
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@JEE@@B!!QP@@(TT@@@@@@@AUUP@@UUT@@EUU@@AUUP@@UUT@@EUU@@@UU@@@@@@@@@@@@@@a'); colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); yourself)); 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]!
|
400
|
1060 |
|
|
1061 |
loadFromClassIcon
|
488
|
1062 |
"Generated by the Image Editor"
|
|
1063 |
"
|
|
1064 |
ImageEditor openOnClass:self andSelector:#loadFromClassIcon
|
|
1065 |
"
|
400
|
1066 |
|
|
1067 |
<resource: #image>
|
488
|
1068 |
|
|
1069 |
^Icon
|
|
1070 |
constantNamed:#'ImageEditor loadFromClassIcon'
|
|
1071 |
ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'DQDQDQDQDQDQDQDQ@@@@@@@@@ADQDQDO????????G!!DQDP????????<^8QDQC4QG]4)G51DQDQDOQD]7)J5=??8QDP=DQ7]JQ=_??!!DQC3L6Y#$61/?>DQDOL3Y&$91,??8QDP<3M&X9M,[??!!DQC2H%UR %-_?>DQDOH"UU (-[??8QDP<"IUT(I[W??!!DQC??????????>DQDOD_G?G?D_D_8QDP<_<_G1<_<_?!!DQC1?1<QG1G1G>DQDOG?G1<_<_<_8QDP<Q<QG1<Q<Q?!!DQC??????????>DQG>;.;.;.;.;.8QDQDQDQDQDQDQDQDb'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color black); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8'); yourself); yourself]!
|
400
|
1072 |
|
|
1073 |
loadFromFileIcon
|
488
|
1074 |
"Generated by the Image Editor"
|
|
1075 |
"
|
|
1076 |
ImageEditor openOnClass:self andSelector:#loadFromFileIcon
|
|
1077 |
"
|
400
|
1078 |
|
|
1079 |
<resource: #image>
|
488
|
1080 |
|
|
1081 |
^Icon
|
|
1082 |
constantNamed:#'ImageEditor loadFromFileIcon'
|
|
1083 |
ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'DQDQDQDQDQDQDQDQ@@@@@@@@@ADQDQDO????????G!!DQDP????????<^8QDQC4QG]4)G51DQDQDOQD]7)J5=??8QDP=DQ7]JQ=_??!!DQC3L6Y#$61/?>DQDOL3Y&$91,??8QDP<3M&X9M,[??!!DQC2H%UR %-_?>DQDOH"UU (-[??8QDP<"IUT(I[W??!!DQC??????????>DQDODQ<_<_?1D_8QDP<_?1?1??G??!!DQC1G?G?G?<Q?>DQDOG?<_<_?1??8QDP<_?1?1D_DQ?!!DQC??????????>DQG>;.;.;.;.;.8QDQDQDQDQDQDQDQDb'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color black); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8'); yourself); yourself]!
|
400
|
1084 |
|
|
1085 |
newImageIcon
|
488
|
1086 |
"Generated by the Image Editor"
|
|
1087 |
"
|
|
1088 |
ImageEditor openOnClass:self andSelector:#newImageIcon
|
|
1089 |
"
|
400
|
1090 |
|
|
1091 |
<resource: #image>
|
488
|
1092 |
|
|
1093 |
^Icon
|
|
1094 |
constantNamed:#'ImageEditor newImageIcon'
|
|
1095 |
ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'DQDQDQDQDQDQDQDQ@@@@@@@@@ADQDQDO????????G!!DQDP????????<^8QDQC4QG]4)G51DQDQDOQD]7)J5=??8QDP=DQ7]JQ=_??!!DQC3L6Y#$61/?>DQDOL3Y&$91,??8QDP<3M&X9M,[??!!DQC2H%UR %-_?>DQDOH"UU (-[??8QDP<"IUT(I[W??!!DQC??????????>DQDOG?G1D_G1<_8QDP<Q<_G?<_G1?!!DQC1DQ<Q?1<_G>DQDOG1G1??G1<_8QDP<_<_DQ?1<_?!!DQC??????????>DQG>;.;.;.;.;.8QDQDQDQDQDQDQDQDb'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color black); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8'); yourself); yourself]!
|
400
|
1096 |
|
|
1097 |
rightMouseKeyIcon
|
488
|
1098 |
"Generated by the Image Editor"
|
|
1099 |
"
|
|
1100 |
ImageEditor openOnClass:self andSelector:#rightMouseKeyIcon
|
|
1101 |
"
|
400
|
1102 |
|
|
1103 |
<resource: #image>
|
488
|
1104 |
|
|
1105 |
^Icon
|
|
1106 |
constantNamed:#'ImageEditor rightMouseKeyIcon'
|
|
1107 |
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@EJJ@@AR" @@T((@@@@@@@AUUP@@UUT@@EUU@@AUUP@@UUT@@EUU@@@UU@@@@@@@@@@@@@@a'); colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); yourself)); 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]!
|
400
|
1108 |
|
|
1109 |
saveAsMethodIcon
|
488
|
1110 |
"Generated by the Image Editor"
|
|
1111 |
"
|
|
1112 |
ImageEditor openOnClass:self andSelector:#saveAsMethodIcon
|
|
1113 |
"
|
400
|
1114 |
|
|
1115 |
<resource: #image>
|
488
|
1116 |
|
|
1117 |
^Icon
|
|
1118 |
constantNamed:#'ImageEditor saveAsMethodIcon'
|
|
1119 |
ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'DQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQD^8QDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDTQG]4)G5>G!!DQDQQD]7)J5=G!!DQDQEDQ7]JQ=_!!8QDQDSL6Y#$61 <ADQDQL3Y&$91,<ODQDQD3M&X9M,XO@QDQDRH%UR %-^;!!DQDQH"UU (-[;.DQDQD"IUT(I[W.8b'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color black); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@H@@@@@@@H3N@ID)@ID)@D3I@@@@@@@@@A @@A @@BP@@@@@@@_?<@_?<@_?<@_?<@_?<@_?<@_?<@_?<@_?<'); yourself); yourself]! !
|
400
|
1120 |
|
|
1121 |
!ImageEditor methodsFor:'accessing'!
|
|
1122 |
|
|
1123 |
image
|
|
1124 |
|
|
1125 |
^self imageEditView image
|
|
1126 |
!
|
|
1127 |
|
|
1128 |
postOpenAction: anAction
|
|
1129 |
|
|
1130 |
postOpenAction := anAction
|
|
1131 |
! !
|
|
1132 |
|
|
1133 |
!ImageEditor methodsFor:'accessing - views'!
|
|
1134 |
|
487
|
1135 |
coordLabel
|
|
1136 |
|
|
1137 |
^builder componentAt: #coordLabel
|
|
1138 |
!
|
|
1139 |
|
400
|
1140 |
fileNameInputField
|
|
1141 |
|
|
1142 |
^builder componentAt: #fileNameInputField
|
|
1143 |
!
|
|
1144 |
|
|
1145 |
imageEditView
|
|
1146 |
|
|
1147 |
^(builder componentAt: #imageEditView) subViews first
|
|
1148 |
!
|
|
1149 |
|
|
1150 |
imagePreView
|
|
1151 |
|
|
1152 |
^(builder componentAt: #imagePreView) subViews first
|
|
1153 |
!
|
|
1154 |
|
|
1155 |
resourceClassInputField
|
|
1156 |
|
|
1157 |
^builder componentAt: #resourceClassInputField
|
|
1158 |
!
|
|
1159 |
|
|
1160 |
resourceSelectorInputField
|
|
1161 |
|
|
1162 |
^builder componentAt: #resourceSelectorInputField
|
|
1163 |
! !
|
|
1164 |
|
475
|
1165 |
!ImageEditor methodsFor:'active help'!
|
|
1166 |
|
|
1167 |
defaultInfoLabel
|
|
1168 |
|
|
1169 |
|usedColors|
|
499
|
1170 |
self image isNil ifTrue: [^'No image loaded.'].
|
475
|
1171 |
self image colorMap isNil ifTrue: [usedColors := '?'] ifFalse: [usedColors := self image usedColors size].
|
|
1172 |
^self image width printString, 'x',
|
|
1173 |
self image height printString, 'x',
|
|
1174 |
(2 raisedTo: self image depth) printString,
|
|
1175 |
(self image mask notNil ifTrue: [' (mask + '] ifFalse: ['(']),
|
|
1176 |
usedColors printString,
|
|
1177 |
' used colors)'
|
|
1178 |
|
|
1179 |
! !
|
|
1180 |
|
400
|
1181 |
!ImageEditor methodsFor:'aspects'!
|
|
1182 |
|
|
1183 |
imageIsLoaded
|
|
1184 |
|
|
1185 |
|holder|
|
|
1186 |
(holder := builder bindingAt:#imageIsLoaded) isNil ifTrue:[
|
|
1187 |
builder aspectAt:#imageIsLoaded put:(holder := false asValue).
|
|
1188 |
].
|
|
1189 |
^ holder
|
|
1190 |
!
|
|
1191 |
|
|
1192 |
listOfColors
|
|
1193 |
|
|
1194 |
|holder|
|
|
1195 |
(holder := builder bindingAt:#listOfColors) isNil ifTrue:[
|
|
1196 |
builder aspectAt:#listOfColors put:(holder := List new).
|
|
1197 |
].
|
|
1198 |
^ holder
|
|
1199 |
!
|
|
1200 |
|
|
1201 |
selectionOfColor
|
|
1202 |
|
|
1203 |
|holder|
|
|
1204 |
(holder := builder bindingAt:#selectionOfColor) isNil ifTrue:[
|
|
1205 |
builder aspectAt:#selectionOfColor put:(
|
|
1206 |
holder := AspectAdaptor new subject:self; forAspect:#selectedColorIndex).
|
|
1207 |
].
|
|
1208 |
^ holder
|
|
1209 |
!
|
|
1210 |
|
|
1211 |
valueOfCoordLabel
|
|
1212 |
|
|
1213 |
|holder|
|
|
1214 |
(holder := builder bindingAt:#valueOfCoordLabel) isNil ifTrue:[
|
|
1215 |
builder aspectAt:#valueOfCoordLabel put:(holder := ValueHolder new).
|
|
1216 |
].
|
|
1217 |
^ holder
|
|
1218 |
!
|
|
1219 |
|
|
1220 |
valueOfFileName
|
|
1221 |
|
|
1222 |
|holder|
|
|
1223 |
(holder := builder bindingAt:#valueOfFileName) isNil ifTrue:[
|
|
1224 |
builder aspectAt:#valueOfFileName put:(holder := '' asValue).
|
|
1225 |
holder addDependent: self
|
|
1226 |
].
|
|
1227 |
^ holder
|
|
1228 |
!
|
|
1229 |
|
|
1230 |
valueOfMagnification
|
|
1231 |
|
|
1232 |
|holder|
|
|
1233 |
(holder := builder bindingAt:#valueOfMagnification) isNil ifTrue:[
|
|
1234 |
builder aspectAt:#valueOfMagnification put:(
|
|
1235 |
holder := AspectAdaptor new subject:self; forAspect:#magnification)
|
|
1236 |
].
|
|
1237 |
^ holder
|
|
1238 |
!
|
|
1239 |
|
|
1240 |
valueOfResourceClass
|
|
1241 |
|
|
1242 |
|holder|
|
|
1243 |
(holder := builder bindingAt:#valueOfResourceClass) isNil ifTrue:[
|
|
1244 |
builder aspectAt:#valueOfResourceClass put: (holder := '' asValue).
|
|
1245 |
holder addDependent: self
|
|
1246 |
].
|
|
1247 |
^ holder
|
|
1248 |
!
|
|
1249 |
|
|
1250 |
valueOfResourceSelector
|
|
1251 |
|
|
1252 |
|holder|
|
|
1253 |
(holder := builder bindingAt:#valueOfResourceSelector) isNil ifTrue:[
|
|
1254 |
builder aspectAt:#valueOfResourceSelector put: (holder := '' asValue).
|
|
1255 |
holder addDependent: self
|
|
1256 |
].
|
|
1257 |
^ holder
|
|
1258 |
! !
|
|
1259 |
|
|
1260 |
!ImageEditor methodsFor:'change & update'!
|
|
1261 |
|
|
1262 |
update:something with:aParameter from:changedObject
|
|
1263 |
|
|
1264 |
something == #value
|
|
1265 |
ifTrue:
|
|
1266 |
[
|
|
1267 |
(changedObject = self valueOfResourceClass)
|
|
1268 |
ifTrue:
|
|
1269 |
[
|
|
1270 |
|s what m|
|
|
1271 |
s := self resourceClassInputField contents withoutSpaces.
|
|
1272 |
what := Smalltalk classnameCompletion:s.
|
|
1273 |
self resourceClassInputField contents:what first.
|
|
1274 |
(what at:2) size ~~ 1 ifTrue:[
|
|
1275 |
Display beep
|
|
1276 |
]
|
|
1277 |
].
|
|
1278 |
(changedObject = self valueOfResourceClass) | (changedObject = self valueOfResourceSelector)
|
|
1279 |
ifTrue:
|
|
1280 |
[
|
|
1281 |
self loadFromMessage: self resourceClassInputField contents, ' ', self resourceSelectorInputField contents
|
|
1282 |
].
|
|
1283 |
(changedObject = self valueOfFileName)
|
|
1284 |
ifTrue:
|
|
1285 |
[
|
|
1286 |
self loadFromFile: self fileNameInputField contents
|
|
1287 |
].
|
|
1288 |
].
|
|
1289 |
|
|
1290 |
super update:something with:aParameter from:changedObject
|
|
1291 |
|
|
1292 |
! !
|
|
1293 |
|
|
1294 |
!ImageEditor methodsFor:'menu modes'!
|
|
1295 |
|
|
1296 |
colorMapMode: aMode
|
|
1297 |
|
|
1298 |
^colorMapMode = aMode
|
|
1299 |
!
|
|
1300 |
|
|
1301 |
colorMapMode: aMode value: aValue
|
|
1302 |
|
405
|
1303 |
|depth newColorMap newImage image newColors realColorMap oldFileName|
|
400
|
1304 |
|
|
1305 |
newColorMap := self class listOfColorMaps at: aMode.
|
|
1306 |
depth := (newColorMap size log: 2) asInteger.
|
|
1307 |
newImage := (Image implementorForDepth: depth) new.
|
|
1308 |
oldFileName := self image fileName.
|
|
1309 |
Object errorSignal handle:
|
|
1310 |
[:ex|
|
|
1311 |
Object errorSignal handle:
|
|
1312 |
[:ex|
|
|
1313 |
^self warn: 'Convertation failed!!'
|
|
1314 |
]
|
|
1315 |
do:
|
|
1316 |
[
|
|
1317 |
self image colorsFromX:0 y:0 toX:(self image width-1) y:(self image height-1) do:
|
|
1318 |
[:x :y :clr |
|
|
1319 |
(newColorMap includes: clr)
|
|
1320 |
ifTrue: [self image colorAtX:x y:y put:clr]
|
|
1321 |
ifFalse: [self image colorAtX:x y:y put: self image colorMap first]
|
|
1322 |
].
|
|
1323 |
image := newImage fromImage: self image.
|
|
1324 |
].
|
|
1325 |
]
|
|
1326 |
do:
|
|
1327 |
[
|
|
1328 |
image := newImage fromImage: self image
|
|
1329 |
].
|
|
1330 |
(String fromString: aMode) reverse readStream nextWord reverse = 'mask'
|
|
1331 |
ifTrue:
|
|
1332 |
[
|
|
1333 |
image mask isNil
|
|
1334 |
ifTrue:
|
|
1335 |
[
|
|
1336 |
image mask: (Depth1Image fromImage: (image asThresholdMonochromeImage: 0.1)).
|
|
1337 |
].
|
|
1338 |
]
|
|
1339 |
ifFalse:
|
|
1340 |
[
|
|
1341 |
image mask: nil.
|
405
|
1342 |
].
|
|
1343 |
realColorMap := OrderedCollection new.
|
|
1344 |
image realColorMap do:
|
|
1345 |
[:clr|
|
|
1346 |
(realColorMap includes: clr) ifFalse: [realColorMap add: clr]
|
400
|
1347 |
].
|
405
|
1348 |
newColors := realColorMap copyFrom: 1 to: (newColorMap size min: realColorMap size).
|
400
|
1349 |
newColorMap do:
|
|
1350 |
[:clr|
|
|
1351 |
((newColors size < newColorMap size) and: [(newColors includes: clr) not])
|
|
1352 |
ifTrue:
|
|
1353 |
[
|
|
1354 |
newColors add: clr
|
|
1355 |
]
|
405
|
1356 |
].
|
400
|
1357 |
image colorMap: newColors.
|
|
1358 |
colorMapMode := aMode.
|
|
1359 |
(self imageEditView image: image) notNil
|
|
1360 |
ifTrue:
|
|
1361 |
[
|
|
1362 |
self image fileName: oldFileName.
|
|
1363 |
self listOfColors contents: image colorMap.
|
|
1364 |
self findColorMapMode.
|
|
1365 |
self updateInputFieldsAndLabelsAndHistory.
|
|
1366 |
]
|
|
1367 |
!
|
|
1368 |
|
|
1369 |
editMode: aMode
|
|
1370 |
|
|
1371 |
^self imageEditView editMode = aMode
|
|
1372 |
!
|
|
1373 |
|
|
1374 |
editMode: aMode value: aValue
|
|
1375 |
|
|
1376 |
self imageEditView editMode: aMode
|
|
1377 |
!
|
|
1378 |
|
|
1379 |
mouseKeyColorMode: aMode
|
|
1380 |
|
|
1381 |
^self imageEditView mouseKeyColorMode = aMode
|
|
1382 |
!
|
|
1383 |
|
|
1384 |
mouseKeyColorMode: aMode value: aValue
|
|
1385 |
|
|
1386 |
self imageEditView mouseKeyColorMode: aMode.
|
|
1387 |
|
|
1388 |
self selectionOfColor value: (self listOfColors indexOf: self imageEditView selectedColor).
|
|
1389 |
! !
|
|
1390 |
|
|
1391 |
!ImageEditor methodsFor:'private'!
|
|
1392 |
|
|
1393 |
findColorMapMode
|
|
1394 |
|
|
1395 |
self image depth > 8 ifTrue: [colorMapMode := ''. self listOfColors removeAll. ^nil].
|
|
1396 |
colorMapMode := self image depth printString, '-plane'.
|
|
1397 |
self listOfColors isEmpty
|
|
1398 |
ifTrue:
|
|
1399 |
[
|
|
1400 |
self colorMapMode: colorMapMode value: nil
|
|
1401 |
].
|
|
1402 |
self imageEditView selectColor: (Array with: (self listOfColors at: 1) with: (self listOfColors at: 2)).
|
|
1403 |
self image mask notNil
|
|
1404 |
ifTrue:
|
|
1405 |
[
|
|
1406 |
colorMapMode := colorMapMode, ' + mask'.
|
|
1407 |
self listOfColors addFirst: (Color basicNew setColorId:0).
|
|
1408 |
self imageEditView selectColor: (Array with: (self listOfColors at: 2) with: (self listOfColors at: 1)).
|
|
1409 |
].
|
|
1410 |
self selectionOfColor value: 0.
|
|
1411 |
self selectionOfColor value: (self listOfColors indexOf: self imageEditView selectedColor).
|
|
1412 |
!
|
|
1413 |
|
|
1414 |
sortColorColumn: aColumn
|
|
1415 |
|
|
1416 |
|
|
1417 |
|
|
1418 |
!
|
|
1419 |
|
449
|
1420 |
updateForNoneImage
|
|
1421 |
|
|
1422 |
self imageIsLoaded value: false.
|
|
1423 |
self listOfColors removeAll.
|
|
1424 |
self imagePreView image: nil
|
|
1425 |
|
|
1426 |
|
|
1427 |
|
|
1428 |
|
|
1429 |
!
|
|
1430 |
|
400
|
1431 |
updateInfoLabel
|
|
1432 |
|
475
|
1433 |
self valueOfInfoLabel value: self defaultInfoLabel
|
400
|
1434 |
|
|
1435 |
!
|
|
1436 |
|
415
|
1437 |
updateInputFields
|
|
1438 |
|
|
1439 |
self valueOfResourceSelector removeDependent: self.
|
|
1440 |
self valueOfResourceSelector value: self imageEditView resourceSelector.
|
|
1441 |
self valueOfResourceSelector addDependent: self.
|
|
1442 |
|
|
1443 |
self valueOfResourceClass removeDependent: self.
|
|
1444 |
self imageEditView resourceClass notNil
|
|
1445 |
ifTrue: [self valueOfResourceClass value: self imageEditView resourceClass]
|
|
1446 |
ifFalse: [self valueOfResourceClass value: ''].
|
|
1447 |
self valueOfResourceClass addDependent: self.
|
|
1448 |
|
|
1449 |
!
|
|
1450 |
|
400
|
1451 |
updateInputFieldsAndLabelsAndHistory
|
|
1452 |
|
|
1453 |
self imageIsLoaded value: self image notNil.
|
|
1454 |
|
|
1455 |
self image isNil ifTrue: [^nil].
|
|
1456 |
|
|
1457 |
self updateInfoLabel.
|
|
1458 |
|
|
1459 |
self valueOfFileName removeDependent: self.
|
|
1460 |
self valueOfFileName value: self image fileName.
|
|
1461 |
self valueOfFileName addDependent: self.
|
|
1462 |
|
415
|
1463 |
self updateInputFields.
|
400
|
1464 |
|
|
1465 |
self imageEditView resourceMessage asCollectionOfWords size = 2
|
|
1466 |
ifTrue: [self addToHistory: self imageEditView resourceMessage -> #loadFromMessage:].
|
|
1467 |
|
|
1468 |
self image fileName notNil
|
|
1469 |
ifTrue: [self addToHistory: self image fileName -> #loadFromFile:].
|
|
1470 |
|
|
1471 |
|
|
1472 |
|
|
1473 |
! !
|
|
1474 |
|
|
1475 |
!ImageEditor methodsFor:'selection'!
|
|
1476 |
|
|
1477 |
magnification
|
|
1478 |
|
|
1479 |
(builder componentAt: #imageEditView) isNil ifTrue: [^1].
|
|
1480 |
^self imageEditView magnification x
|
|
1481 |
!
|
|
1482 |
|
|
1483 |
magnification: aValue
|
|
1484 |
|
|
1485 |
|magnification|
|
|
1486 |
magnification := aValue asInteger asPoint.
|
|
1487 |
(magnification = self imageEditView magnification) | (magnification = (0@0)) ifTrue: [^nil].
|
|
1488 |
self imageEditView magnification: magnification
|
|
1489 |
!
|
|
1490 |
|
|
1491 |
selectedColorIndex
|
|
1492 |
|
|
1493 |
^selectedColorIndex
|
|
1494 |
!
|
|
1495 |
|
|
1496 |
selectedColorIndex: anIndex
|
|
1497 |
|
|
1498 |
selectedColorIndex := anIndex.
|
|
1499 |
self imageEditView selectedColor: (self listOfColors at: anIndex ifAbsent: [^nil])
|
|
1500 |
|
|
1501 |
! !
|
|
1502 |
|
|
1503 |
!ImageEditor methodsFor:'startup / release'!
|
|
1504 |
|
|
1505 |
closeRequest
|
|
1506 |
|
|
1507 |
self imageEditView checkModified ifTrue:[super closeRequest]
|
|
1508 |
|
|
1509 |
!
|
|
1510 |
|
|
1511 |
open
|
|
1512 |
|
|
1513 |
super open.
|
444
|
1514 |
|
420
|
1515 |
self imageEditView masterApplication: self.
|
444
|
1516 |
|
400
|
1517 |
self resourceClassInputField entryCompletionBlock:
|
|
1518 |
[:value|
|
|
1519 |
|what|
|
|
1520 |
what := Smalltalk classnameCompletion: value withoutSpaces.
|
|
1521 |
self resourceClassInputField contents:what first.
|
|
1522 |
(what at:2) size ~~ 1 ifTrue:[
|
|
1523 |
Display beep
|
|
1524 |
]
|
444
|
1525 |
]
|
400
|
1526 |
!
|
|
1527 |
|
|
1528 |
postOpenWith:aBuilder
|
|
1529 |
|
415
|
1530 |
self imageEditView masterApplication: self.
|
400
|
1531 |
postOpenAction notNil ifTrue: [postOpenAction value].
|
|
1532 |
super postOpenWith:aBuilder.
|
|
1533 |
!
|
|
1534 |
|
|
1535 |
reOpen
|
|
1536 |
|
|
1537 |
self imageEditView checkModified ifTrue:[super reOpen]
|
|
1538 |
|
|
1539 |
! !
|
|
1540 |
|
|
1541 |
!ImageEditor methodsFor:'user actions - editing'!
|
|
1542 |
|
|
1543 |
browseClass
|
|
1544 |
|
|
1545 |
SystemBrowser openInClass: (Smalltalk at: self imageEditView resourceClass ifAbsent: [^nil]) class selector: self imageEditView resourceSelector
|
|
1546 |
!
|
|
1547 |
|
|
1548 |
flipHorizontal
|
|
1549 |
|
|
1550 |
self imageEditView flipHorizontal
|
|
1551 |
!
|
|
1552 |
|
|
1553 |
flipVertical
|
|
1554 |
|
|
1555 |
self imageEditView flipVertical
|
|
1556 |
!
|
|
1557 |
|
|
1558 |
magnifyDown
|
|
1559 |
|
|
1560 |
self valueOfMagnification value > 1
|
|
1561 |
ifTrue:
|
|
1562 |
[
|
|
1563 |
self valueOfMagnification value: self valueOfMagnification value - 1
|
|
1564 |
]
|
|
1565 |
!
|
|
1566 |
|
|
1567 |
magnifyImage
|
|
1568 |
|
|
1569 |
self imageEditView magnifyImage.
|
|
1570 |
self updateInfoLabel
|
|
1571 |
!
|
|
1572 |
|
|
1573 |
magnifyUp
|
|
1574 |
|
|
1575 |
self valueOfMagnification value < 99
|
|
1576 |
ifTrue:
|
|
1577 |
[
|
|
1578 |
self valueOfMagnification value: self valueOfMagnification value + 1
|
|
1579 |
]
|
|
1580 |
!
|
|
1581 |
|
|
1582 |
negativeImage
|
|
1583 |
|
|
1584 |
self imageEditView negativeImage.
|
|
1585 |
self listOfColors removeAll.
|
|
1586 |
self findColorMapMode.
|
|
1587 |
!
|
|
1588 |
|
|
1589 |
resizeImage
|
|
1590 |
|
|
1591 |
self imageEditView resizeImage.
|
|
1592 |
self updateInfoLabel
|
|
1593 |
!
|
|
1594 |
|
|
1595 |
rotateImage
|
|
1596 |
|
|
1597 |
self imageEditView rotateImage.
|
|
1598 |
self updateInfoLabel
|
|
1599 |
!
|
|
1600 |
|
|
1601 |
undo
|
|
1602 |
|
|
1603 |
self imageEditView undo
|
|
1604 |
! !
|
|
1605 |
|
|
1606 |
!ImageEditor methodsFor:'user actions - loading'!
|
|
1607 |
|
|
1608 |
loadFromClass
|
|
1609 |
|
|
1610 |
self loadFromInClassesOf: #Object.
|
|
1611 |
|
|
1612 |
!
|
|
1613 |
|
|
1614 |
loadFromFile
|
|
1615 |
|
|
1616 |
self loadFromFile:
|
|
1617 |
(FileSelectionBrowser
|
|
1618 |
request: 'Load Image From'
|
|
1619 |
fileFilters: FileSelectionBrowser loadImageFileNameFilters)
|
|
1620 |
!
|
|
1621 |
|
|
1622 |
loadFromFile: aFileName
|
|
1623 |
|
461
|
1624 |
(self imageEditView loadFromFile: aFileName) notNil
|
450
|
1625 |
ifTrue:
|
|
1626 |
[
|
461
|
1627 |
self image notNil
|
400
|
1628 |
ifTrue:
|
461
|
1629 |
[
|
|
1630 |
self image colorMap notNil
|
|
1631 |
ifTrue:
|
|
1632 |
[
|
|
1633 |
self listOfColors contents: self image usedColors asSet.
|
|
1634 |
]
|
|
1635 |
ifFalse:
|
|
1636 |
[
|
|
1637 |
self listOfColors removeAll.
|
|
1638 |
].
|
|
1639 |
self findColorMapMode.
|
|
1640 |
self updateInputFieldsAndLabelsAndHistory.
|
400
|
1641 |
]
|
|
1642 |
ifFalse:
|
|
1643 |
[
|
461
|
1644 |
self updateForNoneImage
|
|
1645 |
]
|
449
|
1646 |
]
|
400
|
1647 |
!
|
|
1648 |
|
|
1649 |
loadFromImage: image
|
|
1650 |
|
450
|
1651 |
self imageEditView image: image.
|
|
1652 |
self image notNil
|
400
|
1653 |
ifTrue:
|
|
1654 |
[
|
|
1655 |
self image colorMap notNil
|
|
1656 |
ifTrue:
|
|
1657 |
[
|
|
1658 |
self listOfColors contents: self image usedColors asSet asOrderedCollection.
|
|
1659 |
]
|
|
1660 |
ifFalse:
|
|
1661 |
[
|
|
1662 |
self listOfColors removeAll.
|
|
1663 |
].
|
|
1664 |
self findColorMapMode.
|
|
1665 |
self updateInputFieldsAndLabelsAndHistory.
|
|
1666 |
]
|
449
|
1667 |
ifFalse:
|
|
1668 |
[
|
|
1669 |
self updateForNoneImage
|
|
1670 |
]
|
400
|
1671 |
!
|
|
1672 |
|
|
1673 |
loadFromInClassesOf: aSuperclassOrSymbol
|
|
1674 |
|
461
|
1675 |
(self imageEditView loadFromInClassesOf: aSuperclassOrSymbol) notNil
|
400
|
1676 |
ifTrue:
|
|
1677 |
[
|
461
|
1678 |
self image notNil
|
|
1679 |
ifTrue:
|
|
1680 |
[
|
|
1681 |
self listOfColors contents: self image usedColors asSet asOrderedCollection.
|
|
1682 |
self findColorMapMode.
|
|
1683 |
self updateInputFieldsAndLabelsAndHistory.
|
|
1684 |
]
|
|
1685 |
ifFalse:
|
|
1686 |
[
|
|
1687 |
self updateForNoneImage
|
|
1688 |
]
|
449
|
1689 |
]
|
400
|
1690 |
!
|
|
1691 |
|
|
1692 |
loadFromMessage: aMessage
|
|
1693 |
|
461
|
1694 |
(self imageEditView loadFromMessage: aMessage) notNil
|
400
|
1695 |
ifTrue:
|
|
1696 |
[
|
461
|
1697 |
self image notNil
|
|
1698 |
ifTrue:
|
|
1699 |
[
|
|
1700 |
self listOfColors contents: self image usedColors asSet asOrderedCollection.
|
|
1701 |
self findColorMapMode.
|
|
1702 |
self updateInputFieldsAndLabelsAndHistory.
|
|
1703 |
]
|
|
1704 |
ifFalse:
|
|
1705 |
[
|
|
1706 |
self updateForNoneImage
|
|
1707 |
]
|
400
|
1708 |
]
|
|
1709 |
!
|
|
1710 |
|
415
|
1711 |
loadFromOrPrepareForMessage: aMessage
|
|
1712 |
|
|
1713 |
(self imageEditView loadFromMessage: aMessage) notNil
|
|
1714 |
ifTrue:
|
|
1715 |
[
|
|
1716 |
self listOfColors contents: self image usedColors asSet asOrderedCollection.
|
|
1717 |
self findColorMapMode.
|
|
1718 |
self updateInputFieldsAndLabelsAndHistory.
|
|
1719 |
]
|
|
1720 |
ifFalse:
|
|
1721 |
[
|
|
1722 |
self imageEditView resourceMessage: aMessage.
|
|
1723 |
self updateInputFields.
|
|
1724 |
]
|
|
1725 |
!
|
|
1726 |
|
400
|
1727 |
newImage
|
|
1728 |
|
|
1729 |
|aspects|
|
|
1730 |
aspects := IdentityDictionary new
|
|
1731 |
at:#listOfSizes put: self class listOfDefaultSizes asValue;
|
|
1732 |
at:#listOfColorMaps put: self class listOfColorMaps keys asSortedCollection asValue;
|
|
1733 |
at:#selectionOfSize put: self class listOfDefaultSizes first copy asValue;
|
|
1734 |
at:#selectionOfColorMap put: self class listOfColorMaps keys asSortedCollection first asValue;
|
|
1735 |
yourself.
|
|
1736 |
|
|
1737 |
(self openDialogInterface:#windowSpecForNewImage withBindings:aspects)
|
|
1738 |
ifTrue:
|
|
1739 |
[
|
|
1740 |
|width height cMap imageClass image|
|
|
1741 |
width := 128 min: (Integer readFromString: ((aspects at:#selectionOfSize) value upTo: $x) onError:[24]).
|
|
1742 |
height := 128 min: (Integer readFromString: ((aspects at:#selectionOfSize) value copy reverse upTo: $x) reverse onError:[24]).
|
|
1743 |
|
|
1744 |
cMap := (self class listOfColorMaps at: (colorMapMode := (aspects at:#selectionOfColorMap) value)).
|
|
1745 |
imageClass := Image implementorForDepth: ((cMap size log: 2) asInteger).
|
|
1746 |
image := imageClass width: width height: height fromArray: (ByteArray new: width*height).
|
|
1747 |
|
|
1748 |
(colorMapMode copy reverse readStream nextWord reverse = 'mask')
|
|
1749 |
ifTrue:
|
|
1750 |
[
|
|
1751 |
image mask: (Depth1Image width: width height: height depth: 1 fromArray: (ByteArray new: width*height)) clearMaskedPixels.
|
|
1752 |
].
|
|
1753 |
image colorMap: cMap.
|
|
1754 |
image fillRectangleX:0 y:0 width:width height:height with:Color white.
|
|
1755 |
(self imageEditView image: image) notNil
|
|
1756 |
ifTrue:
|
|
1757 |
[
|
|
1758 |
self listOfColors contents: cMap.
|
|
1759 |
self findColorMapMode.
|
|
1760 |
self updateInputFieldsAndLabelsAndHistory
|
|
1761 |
]
|
|
1762 |
].
|
|
1763 |
! !
|
|
1764 |
|
|
1765 |
!ImageEditor methodsFor:'user actions - saving'!
|
|
1766 |
|
|
1767 |
print
|
|
1768 |
|
|
1769 |
self imageEditView print
|
|
1770 |
!
|
|
1771 |
|
|
1772 |
saveImageFile
|
|
1773 |
|
|
1774 |
self imageEditView saveImageFileAs: self fileNameInputField contents
|
|
1775 |
!
|
|
1776 |
|
|
1777 |
saveImageFileAs
|
|
1778 |
|
|
1779 |
self imageEditView saveImageFileAs.
|
|
1780 |
self updateInputFieldsAndLabelsAndHistory
|
|
1781 |
!
|
|
1782 |
|
|
1783 |
saveImageMaskFileAs
|
|
1784 |
|
|
1785 |
self imageEditView saveImageMaskFileAs
|
|
1786 |
!
|
|
1787 |
|
|
1788 |
saveMethod
|
|
1789 |
|
|
1790 |
(self imageEditView
|
|
1791 |
resourceSelector: self resourceSelectorInputField contents;
|
|
1792 |
resourceClass: self resourceClassInputField contents;
|
|
1793 |
saveMethod) notNil
|
|
1794 |
ifTrue:
|
|
1795 |
[
|
|
1796 |
self updateInputFieldsAndLabelsAndHistory
|
|
1797 |
]
|
|
1798 |
!
|
|
1799 |
|
|
1800 |
saveMethodAs
|
|
1801 |
|
|
1802 |
self imageEditView saveMethodAs notNil
|
|
1803 |
ifTrue:
|
|
1804 |
[
|
|
1805 |
self updateInputFieldsAndLabelsAndHistory
|
|
1806 |
]
|
|
1807 |
! !
|
|
1808 |
|
|
1809 |
!ImageEditor class methodsFor:'documentation'!
|
|
1810 |
|
|
1811 |
version
|
|
1812 |
^ '$Header$'
|
|
1813 |
! !
|