author | Claus Gittinger <cg@exept.de> |
Mon, 03 Nov 1997 16:19:36 +0100 | |
changeset 606 | fefb91a25597 |
parent 599 | 66c4da764a9e |
child 624 | d98fe4700fc2 |
permissions | -rw-r--r-- |
1 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
26 | 3 |
All Rights Reserved |
1 | 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 |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
ImageView subclass:#ImageEditView |
|
404 | 14 |
instanceVariableNames:'magnification colors magnifiedImage colorPanel pathName enhance |
15 |
antiAlias' |
|
161 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'Views-Misc' |
|
1 | 19 |
! |
20 |
||
255 | 21 |
!ImageEditView class methodsFor:'documentation'! |
64 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
This View will eventually be able to edit bitmap images. |
|
40 |
For now, it is not. |
|
296 | 41 |
|
42 |
[author:] |
|
43 |
Claus Gittinger |
|
44 |
||
45 |
[see also:] |
|
46 |
Image Form |
|
353 | 47 |
|
48 |
[start with:] |
|
49 |
ImageEditView openOn:'bitmaps/gifImages/garfield.gif' |
|
50 |
ImageEditView openOnImage:(Image fromFile:'bitmaps/gifImages/garfield.gif') |
|
64 | 51 |
" |
1 | 52 |
! ! |
53 |
||
353 | 54 |
!ImageEditView class methodsFor:'startup'! |
55 |
||
56 |
openOn:aFileName |
|
57 |
"startup an image editor on an image read from a file" |
|
58 |
||
599 | 59 |
|editView fn dir| |
353 | 60 |
|
61 |
editView := super openOn:aFileName. |
|
599 | 62 |
dir := (fn := aFileName asFilename) directory. |
63 |
dir exists ifTrue:[ |
|
64 |
editView pathName:(fn pathName). |
|
65 |
]. |
|
353 | 66 |
|
67 |
^ editView |
|
68 |
||
69 |
" |
|
70 |
ImageEditView openOn:'bitmaps/gifImages/garfield.gif' |
|
71 |
ImageEditView openOn:'bitmaps/xpmBitmaps/BOOK.xpm' |
|
72 |
" |
|
73 |
||
599 | 74 |
"Modified: / 31.10.1997 / 16:19:23 / cg" |
353 | 75 |
! ! |
76 |
||
7 | 77 |
!ImageEditView methodsFor:'accessing'! |
78 |
||
79 |
image:anImage |
|
295
6388ebe84be2
fixed display of magnified image with mask.
Claus Gittinger <cg@exept.de>
parents:
294
diff
changeset
|
80 |
|oldMag| |
6388ebe84be2
fixed display of magnified image with mask.
Claus Gittinger <cg@exept.de>
parents:
294
diff
changeset
|
81 |
|
6388ebe84be2
fixed display of magnified image with mask.
Claus Gittinger <cg@exept.de>
parents:
294
diff
changeset
|
82 |
oldMag := magnification. |
7 | 83 |
magnification := 1@1. |
84 |
magnifiedImage := nil. |
|
295
6388ebe84be2
fixed display of magnified image with mask.
Claus Gittinger <cg@exept.de>
parents:
294
diff
changeset
|
85 |
super image:anImage. |
6388ebe84be2
fixed display of magnified image with mask.
Claus Gittinger <cg@exept.de>
parents:
294
diff
changeset
|
86 |
self magnification:oldMag |
6388ebe84be2
fixed display of magnified image with mask.
Claus Gittinger <cg@exept.de>
parents:
294
diff
changeset
|
87 |
|
6388ebe84be2
fixed display of magnified image with mask.
Claus Gittinger <cg@exept.de>
parents:
294
diff
changeset
|
88 |
"Modified: 20.2.1997 / 18:29:13 / cg" |
255 | 89 |
! |
90 |
||
91 |
magnification:aMagnificationPoint |
|
413 | 92 |
|nPixel savedImage oldBounds newBounds rects| |
255 | 93 |
|
94 |
magnification ~= aMagnificationPoint ifTrue:[ |
|
95 |
"show wait cursor; although magnification is fast, dithering may take a while" |
|
413 | 96 |
self withWaitCursorDo:[ |
97 |
magnifiedImage isNil ifTrue:[ |
|
98 |
oldBounds := image bounds. |
|
99 |
] ifFalse:[ |
|
100 |
oldBounds := magnifiedImage bounds |
|
101 |
]. |
|
255 | 102 |
|
413 | 103 |
(device visualType == #PseudoColor) ifTrue:[ |
104 |
"release kept colors" |
|
105 |
colors := IdentitySet new. |
|
106 |
]. |
|
107 |
||
108 |
magnification := aMagnificationPoint asPoint. |
|
255 | 109 |
|
413 | 110 |
"use a magnified image, if its size wont be too big" |
111 |
magnifiedImage := nil. |
|
255 | 112 |
|
413 | 113 |
"avoid slow scroll" |
114 |
savedImage := image. |
|
115 |
image := nil. |
|
116 |
self scrollToTopLeft. |
|
117 |
image := savedImage. |
|
255 | 118 |
|
413 | 119 |
magnification ~= (1@1) ifTrue:[ |
120 |
nPixel := image width * image height * magnification x * magnification y. |
|
121 |
nPixel <= (2000 * 2000) ifTrue:[ |
|
122 |
Transcript showCR:'magnifying ..'; endEntry. |
|
123 |
antiAlias ifTrue:[ |
|
124 |
magnifiedImage := image hardAntiAliasedMagnifiedBy:magnification |
|
125 |
] ifFalse:[ |
|
126 |
magnifiedImage := image magnifiedBy:magnification |
|
127 |
] |
|
128 |
]. |
|
129 |
]. |
|
255 | 130 |
|
413 | 131 |
self contentsChanged. |
132 |
||
133 |
magnifiedImage isNil ifTrue:[ |
|
134 |
newBounds := image bounds. |
|
135 |
] ifFalse:[ |
|
136 |
newBounds := magnifiedImage bounds |
|
137 |
]. |
|
138 |
(rects := oldBounds areasOutside:newBounds) notNil ifTrue:[ |
|
139 |
rects do:[:rect | |
|
140 |
self clearRectangle:rect+(1@1). |
|
404 | 141 |
] |
413 | 142 |
] |
255 | 143 |
]. |
144 |
self invalidate. |
|
145 |
] |
|
146 |
||
413 | 147 |
"Modified: 4.6.1997 / 13:38:16 / cg" |
353 | 148 |
! |
149 |
||
150 |
pathName:aPathName |
|
151 |
"set the pathName of the edited image. |
|
152 |
This is used as a default in the save-dialog" |
|
153 |
||
154 |
pathName := aPathName |
|
155 |
||
156 |
"Created: 10.4.1997 / 17:31:54 / cg" |
|
7 | 157 |
! ! |
158 |
||
1 | 159 |
!ImageEditView methodsFor:'drawing'! |
160 |
||
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
161 |
redrawX:x y:y width:w height:h |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
162 |
|area ih iw dotW dotH minX maxX minY maxY color last lastY runW x0 oldClip| |
1 | 163 |
|
164 |
image isNil ifTrue:[^ self]. |
|
165 |
||
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
166 |
(magnification = (1@1)) ifTrue:[ |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
167 |
super redrawX:x y:y width:w height:h. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
168 |
^ self |
1 | 169 |
]. |
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
170 |
|
1 | 171 |
magnifiedImage notNil ifTrue:[ |
413 | 172 |
self function:#copy. |
173 |
self paint:Black. |
|
174 |
||
175 |
magnifiedImage device ~~ device ifTrue:[ |
|
176 |
"/ this may take some time (allocating colors & dithering |
|
205
96f80d06fe5a
oops - care for d1 images colors
Claus Gittinger <cg@exept.de>
parents:
204
diff
changeset
|
177 |
|
413 | 178 |
self |
179 |
displayRectangleX:margin y:margin |
|
180 |
width:magnifiedImage width height:magnifiedImage height. |
|
181 |
||
182 |
self withWaitCursorDo:[ |
|
183 |
magnifiedImage := magnifiedImage on:device. |
|
184 |
] |
|
204 | 185 |
]. |
186 |
||
413 | 187 |
self withWaitCursorDo:[ |
188 |
magnifiedImage depth == 1 ifTrue:[ |
|
189 |
self paint:(magnifiedImage colorFromValue:1) |
|
190 |
on:(magnifiedImage colorFromValue:0). |
|
191 |
] ifFalse:[ |
|
192 |
self paint:Black on:White. |
|
193 |
]. |
|
295
6388ebe84be2
fixed display of magnified image with mask.
Claus Gittinger <cg@exept.de>
parents:
294
diff
changeset
|
194 |
|
413 | 195 |
(magnifiedImage depth ~~ 1 |
196 |
and:[magnifiedImage mask notNil]) ifTrue:[ |
|
197 |
self clearRectangleX:x y:y width:w height:h. |
|
198 |
self displayForm:magnifiedImage x:margin y:margin |
|
199 |
] ifFalse:[ |
|
200 |
self displayOpaqueForm:magnifiedImage x:margin y:margin |
|
201 |
]. |
|
430 | 202 |
|
203 |
"/ right of image ? |
|
204 |
(x + w - 1) > magnifiedImage width ifTrue:[ |
|
205 |
self clearRectangleX:(magnifiedImage width) |
|
206 |
y:y |
|
207 |
width:(x + w - 1 - magnifiedImage width) |
|
208 |
height:h |
|
209 |
]. |
|
210 |
"/ below of image ? |
|
211 |
(y + h - 1) > magnifiedImage height ifTrue:[ |
|
212 |
self clearRectangleX:margin |
|
213 |
y:(magnifiedImage height) |
|
214 |
width:w |
|
215 |
height:(y + h - 1 - magnifiedImage height) |
|
216 |
]. |
|
295
6388ebe84be2
fixed display of magnified image with mask.
Claus Gittinger <cg@exept.de>
parents:
294
diff
changeset
|
217 |
]. |
6388ebe84be2
fixed display of magnified image with mask.
Claus Gittinger <cg@exept.de>
parents:
294
diff
changeset
|
218 |
|
203 | 219 |
^ self |
1 | 220 |
]. |
221 |
||
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
222 |
ih := image height. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
223 |
iw := image width. |
1 | 224 |
dotW := magnification x. |
225 |
dotH := magnification y. |
|
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
226 |
|
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
227 |
minX := x // dotW. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
228 |
minY := y // dotW. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
229 |
maxX := (x + w) // dotW + 1. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
230 |
maxX > iw ifTrue:[ |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
231 |
maxX := iw |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
232 |
]. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
233 |
maxY := (y + h) // dotH + 1. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
234 |
maxY > ih ifTrue:[ |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
235 |
maxY := ih |
1 | 236 |
]. |
237 |
||
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
238 |
lastY := -1. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
239 |
|
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
240 |
x0 := minX. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
241 |
runW := 0. |
204 | 242 |
|
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
243 |
image colorsFromX:minX y:minY toX:maxX-1 y:maxY-1 do:[:x :y :color | |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
244 |
y ~~ lastY ifTrue:[ |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
245 |
runW ~~ 0 ifTrue:[ |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
246 |
self fillRectangleX:(x0 * dotW + margin) |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
247 |
y:(lastY * dotH + margin) |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
248 |
width:runW height:dotH. |
203 | 249 |
runW := 0. |
250 |
]. |
|
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
251 |
x0 := x. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
252 |
lastY := y. |
204 | 253 |
]. |
1 | 254 |
|
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
255 |
color ~~ last ifTrue:[ |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
256 |
runW ~~ 0 ifTrue:[ |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
257 |
self fillRectangleX:(x0 * dotW + margin) |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
258 |
y:(y * dotH + margin) |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
259 |
width:runW height:dotH. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
260 |
runW := 0. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
261 |
]. |
204 | 262 |
|
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
263 |
"/ keep colors - otherwise they might get collected & changed |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
264 |
colors notNil ifTrue:[colors add:color]. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
265 |
self paint:color. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
266 |
last := color. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
267 |
runW := 0. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
268 |
x0 := x. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
269 |
]. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
270 |
runW := runW + dotW |
191 | 271 |
]. |
272 |
||
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
273 |
runW ~~ 0 ifTrue:[ |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
274 |
self fillRectangleX:(x0 * dotW + margin) |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
275 |
y:(lastY * dotH + margin) |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
276 |
width:runW height:dotH. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
277 |
runW := 0. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
278 |
]. |
191 | 279 |
|
430 | 280 |
"Modified: 23.6.1997 / 21:24:40 / cg" |
1 | 281 |
! ! |
282 |
||
161 | 283 |
!ImageEditView methodsFor:'event handling'! |
284 |
||
285 |
buttonMotion:state x:x y:y |
|
286 |
self showColorAtX:x y:y. |
|
287 |
! |
|
288 |
||
167
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
289 |
buttonMultiPress:button x:x y:y |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
290 |
button == 1 ifTrue:[ |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
291 |
|clr| |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
292 |
clr := self getColorAtX:x y:y. |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
293 |
clr inspect. |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
294 |
]. |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
295 |
super buttonMultiPress:button x:x y:y |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
296 |
|
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
297 |
"Created: 8.5.1996 / 00:18:06 / stefan" |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
298 |
! |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
299 |
|
161 | 300 |
buttonPress:button x:x y:y |
301 |
button == 1 ifTrue:[ |
|
302 |
self showColorAtX:x y:y. |
|
303 |
^ self |
|
304 |
]. |
|
305 |
super buttonPress:button x:x y:y |
|
306 |
! |
|
307 |
||
167
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
308 |
getColorAtX:x y:y |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
309 |
|pi| |
161 | 310 |
|
311 |
pi := (x @ y) - margin. |
|
312 |
pi := pi // magnification. |
|
313 |
((0@0 corner:image extent) containsPoint:pi) ifTrue:[ |
|
167
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
314 |
^ image at:pi. |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
315 |
]. |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
316 |
^ nil |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
317 |
|
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
318 |
"Created: 8.5.1996 / 00:15:55 / stefan" |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
319 |
! |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
320 |
|
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
321 |
showColorAtX:x y:y |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
322 |
|clr| |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
323 |
|
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
324 |
clr := self getColorAtX:x y:y. |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
325 |
clr notNil ifTrue:[ |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
326 |
colorPanel notNil ifTrue:[ |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
327 |
colorPanel setColor:clr. |
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
328 |
] ifFalse:[ |
184 | 329 |
Transcript showCR:clr displayString |
167
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
330 |
] |
161 | 331 |
] |
167
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
332 |
|
0d6d90115420
Doubleclick on pixel opens colorInspector.
Stefan Vogel <sv@exept.de>
parents:
161
diff
changeset
|
333 |
"Modified: 8.5.1996 / 00:20:45 / stefan" |
161 | 334 |
! ! |
335 |
||
406 | 336 |
!ImageEditView methodsFor:'image conversion'! |
337 |
||
338 |
convertToColor24 |
|
339 |
(Depth24Image fromImage:image) inspect |
|
340 |
||
341 |
"Modified: 3.6.1997 / 18:34:34 / cg" |
|
342 |
! |
|
343 |
||
344 |
convertToColor4 |
|
345 |
(Depth4Image fromImage:image) inspect |
|
346 |
||
347 |
"Modified: 3.6.1997 / 18:34:45 / cg" |
|
348 |
! |
|
349 |
||
350 |
convertToColor8 |
|
351 |
(Depth8Image fromImage:image) inspect |
|
352 |
||
353 |
"Created: 3.6.1997 / 18:34:08 / cg" |
|
354 |
"Modified: 3.6.1997 / 18:34:51 / cg" |
|
355 |
! |
|
356 |
||
357 |
convertToGray2 |
|
358 |
(image asFloydSteinbergDitheredGrayImageDepth:2) inspect |
|
359 |
||
360 |
"Created: 3.6.1997 / 18:34:02 / cg" |
|
361 |
"Modified: 3.6.1997 / 18:39:23 / cg" |
|
362 |
! |
|
363 |
||
364 |
convertToGray4 |
|
365 |
(image asFloydSteinbergDitheredGrayImageDepth:4) inspect |
|
366 |
||
367 |
"Created: 3.6.1997 / 18:34:04 / cg" |
|
368 |
"Modified: 3.6.1997 / 18:39:20 / cg" |
|
369 |
! |
|
370 |
||
371 |
convertToGray8 |
|
372 |
(image asFloydSteinbergDitheredGrayImageDepth:8) inspect |
|
373 |
||
374 |
"Created: 3.6.1997 / 18:34:05 / cg" |
|
375 |
"Modified: 3.6.1997 / 18:39:16 / cg" |
|
376 |
! |
|
377 |
||
378 |
convertToMono |
|
379 |
(image asFloydSteinbergDitheredGrayImageDepth:1) inspect |
|
380 |
||
381 |
"Created: 3.6.1997 / 18:33:42 / cg" |
|
382 |
"Modified: 3.6.1997 / 18:39:26 / cg" |
|
383 |
! ! |
|
384 |
||
161 | 385 |
!ImageEditView methodsFor:'image processing'! |
386 |
||
387 |
blurr |
|
388 |
self performImageOperation:#blurr withArguments:nil |
|
389 |
! |
|
390 |
||
391 |
flipHorizontal |
|
392 |
self performImageOperation:#flipHorizontal withArguments:nil |
|
393 |
! |
|
394 |
||
395 |
flipVertical |
|
396 |
self performImageOperation:#flipVertical withArguments:nil |
|
397 |
! |
|
398 |
||
426 | 399 |
negative |
400 |
self performImageOperation:#negative withArguments:nil |
|
401 |
||
402 |
"Modified: 20.6.1997 / 13:14:45 / cg" |
|
403 |
! |
|
404 |
||
161 | 405 |
performImageOperation:operation withArguments:args |
429 | 406 |
|oldMag newImage| |
161 | 407 |
|
408 |
windowGroup withCursor:Cursor wait do:[ |
|
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
409 |
oldMag := magnification. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
410 |
magnifiedImage := nil. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
411 |
magnification := 1@1. |
429 | 412 |
newImage := image perform:operation withArguments:args. |
413 |
newImage isNil ifTrue:[ |
|
414 |
self information:'conversion failed - revert to original'. |
|
415 |
^ self |
|
416 |
]. |
|
417 |
image := newImage. |
|
413 | 418 |
self clear. |
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
419 |
(oldMag isNil or:[oldMag = magnification]) ifTrue:[ |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
420 |
self invalidate |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
421 |
] ifFalse:[ |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
422 |
self magnification:oldMag. |
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
423 |
] |
161 | 424 |
] |
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
425 |
|
429 | 426 |
"Modified: 23.6.1997 / 09:49:26 / cg" |
322 | 427 |
! |
428 |
||
477 | 429 |
resizeImage |
430 |
|b newSize newImage wNew hNew bits| |
|
431 |
||
432 |
b := EnterBox new. |
|
433 |
b title:'new size (x @ y) contents will be located at top-left'. |
|
434 |
b okText:'apply'. |
|
435 |
b abortText:'abort'. |
|
436 |
b action:[:string | newSize := Object readFromString:string onError:nil]. |
|
437 |
b initialText:(image extent printString). |
|
438 |
b showAtPointer. |
|
439 |
||
440 |
newSize notNil ifTrue:[ |
|
441 |
wNew := image width min:newSize x. |
|
442 |
hNew := image height min:newSize y. |
|
443 |
||
444 |
newImage := Image width:(newSize x) height:(newSize y) depth:(image depth). |
|
445 |
newImage photometric:image photometric. |
|
446 |
newImage colorMap:image colorMap copy. |
|
447 |
newImage bits:(ByteArray new:(newImage bytesPerRow * newSize y)). |
|
448 |
||
449 |
newImage copyFrom:image x:0 y:0 toX:0 y:0 width:wNew height:hNew. |
|
450 |
||
451 |
newImage inspect |
|
452 |
]. |
|
453 |
||
454 |
"Created: 31.7.1997 / 11:41:14 / cg" |
|
455 |
"Modified: 31.7.1997 / 13:45:47 / cg" |
|
456 |
! |
|
457 |
||
322 | 458 |
rotateCCW |
459 |
self performImageOperation:#rotated: withArguments:#(270) |
|
460 |
||
461 |
"Created: 17.3.1997 / 11:56:42 / cg" |
|
462 |
! |
|
463 |
||
464 |
rotateCW |
|
465 |
self performImageOperation:#rotated: withArguments:#(90) |
|
466 |
||
467 |
"Created: 17.3.1997 / 11:56:36 / cg" |
|
161 | 468 |
! ! |
469 |
||
1 | 470 |
!ImageEditView methodsFor:'initialization'! |
471 |
||
161 | 472 |
initialize |
473 |
super initialize. |
|
474 |
magnification := 1@1. |
|
404 | 475 |
antiAlias := false. |
296 | 476 |
colors := nil. |
477 |
||
478 |
self menuHolder:self; menuPerformer:self; menuMessage:#imageMenu. |
|
479 |
||
404 | 480 |
"Modified: 2.6.1997 / 15:49:00 / cg" |
297 | 481 |
! ! |
482 |
||
483 |
!ImageEditView methodsFor:'menu'! |
|
484 |
||
485 |
imageMenu |
|
406 | 486 |
|m convertMenu labels selectors| |
161 | 487 |
|
297 | 488 |
image mask notNil ifTrue:[ |
489 |
labels := #( |
|
490 |
'save as ...' |
|
491 |
'save mask as ...' |
|
492 |
). |
|
493 |
selectors := #( |
|
494 |
saveAs |
|
495 |
saveMaskAs |
|
496 |
). |
|
497 |
magnifiedImage notNil ifTrue:[ |
|
498 |
labels := labels , #( |
|
499 |
'-' |
|
500 |
'save magnified as ...' |
|
501 |
'save magnified mask as ...' |
|
502 |
). |
|
5 | 503 |
|
297 | 504 |
selectors := selectors , #( |
505 |
nil |
|
506 |
saveMagnifiedAs |
|
507 |
saveMagnifiedMaskAs |
|
508 |
). |
|
509 |
] |
|
510 |
] ifFalse:[ |
|
511 |
labels := #( |
|
512 |
'save as ...' |
|
513 |
). |
|
514 |
selectors := #( |
|
515 |
saveAs |
|
516 |
). |
|
517 |
magnifiedImage notNil ifTrue:[ |
|
518 |
labels := labels , #( |
|
519 |
'-' |
|
520 |
'save magnified as ...' |
|
521 |
). |
|
522 |
||
523 |
selectors := selectors , #( |
|
524 |
nil |
|
525 |
saveMagnifiedAs |
|
526 |
). |
|
527 |
] |
|
528 |
]. |
|
529 |
||
530 |
labels := labels , #( |
|
531 |
'-' |
|
362 | 532 |
'print' |
405 | 533 |
'print magnified' |
362 | 534 |
'-' |
297 | 535 |
'magnification' |
404 | 536 |
'magnify & antiAlias' |
26 | 537 |
"/ 'colors' |
297 | 538 |
'effects' |
406 | 539 |
'convert to' |
297 | 540 |
). |
541 |
selectors := selectors , #( |
|
542 |
nil |
|
362 | 543 |
doPrint |
405 | 544 |
doPrintMagnified |
362 | 545 |
nil |
297 | 546 |
changeMagnification |
404 | 547 |
changeMagnificationAndAntiAlias |
26 | 548 |
"/ showColors |
297 | 549 |
effects |
406 | 550 |
convert |
297 | 551 |
). |
552 |
||
553 |
m := PopUpMenu |
|
554 |
labels:(resources array:labels) |
|
555 |
selectors:selectors |
|
556 |
receiver:self |
|
557 |
for:self. |
|
5 | 558 |
|
405 | 559 |
magnification = 1 ifTrue:[ |
560 |
m disable:#doPrintMagnified |
|
561 |
]. |
|
562 |
||
5 | 563 |
m subMenuAt:#effects put:( |
297 | 564 |
PopUpMenu labels:(resources array:#( |
565 |
'flip - vertical' |
|
566 |
'flip - horizontal' |
|
322 | 567 |
'-' |
568 |
'rotate - clockwise' |
|
569 |
'rotate - counter clockwise' |
|
426 | 570 |
'-' |
571 |
'negative' |
|
477 | 572 |
'-' |
573 |
'resize' |
|
11 | 574 |
" |
297 | 575 |
'blurr' |
11 | 576 |
" |
297 | 577 |
)) |
578 |
selectors:#( |
|
579 |
flipVertical |
|
580 |
flipHorizontal |
|
322 | 581 |
nil |
582 |
rotateCW |
|
583 |
rotateCCW |
|
426 | 584 |
nil |
585 |
negative |
|
477 | 586 |
nil |
587 |
resizeImage |
|
11 | 588 |
" |
297 | 589 |
blurr |
11 | 590 |
" |
297 | 591 |
) |
592 |
receiver:self |
|
593 |
for:self |
|
5 | 594 |
|
595 |
). |
|
1 | 596 |
|
406 | 597 |
m subMenuAt:#convert put:( |
598 |
convertMenu := |
|
599 |
PopUpMenu labels:(resources array:#( |
|
600 |
'monochrome (dither)' |
|
601 |
'-' |
|
602 |
'gray 2-plane (dither)' |
|
603 |
'gray 4-plane (dither) ' |
|
604 |
'gray 8-plane ' |
|
605 |
'-' |
|
606 |
"/ 'color 4-plane (dither)' |
|
607 |
"/ 'color 8-plane (dither)' |
|
608 |
'color 24-plane' |
|
609 |
)) |
|
610 |
selectors:#( |
|
611 |
convertToMono |
|
612 |
nil |
|
613 |
convertToGray2 |
|
614 |
convertToGray4 |
|
615 |
convertToGray8 |
|
616 |
nil |
|
617 |
"/ convertToColor4 |
|
618 |
"/ convertToColor8 |
|
619 |
convertToColor24 |
|
620 |
) |
|
621 |
receiver:self |
|
622 |
for:self |
|
623 |
). |
|
426 | 624 |
|
406 | 625 |
image depth == 1 ifTrue:[ |
626 |
convertMenu disable:#convertToMono |
|
627 |
]. |
|
628 |
image depth == 2 ifTrue:[ |
|
629 |
(image photometric ~~ #palette |
|
630 |
and:[image photometric ~~ #rgb]) ifTrue:[ |
|
631 |
convertMenu disable:#convertToGray2 |
|
632 |
] |
|
633 |
]. |
|
634 |
image depth == 4 ifTrue:[ |
|
635 |
(image photometric ~~ #palette |
|
636 |
and:[image photometric ~~ #rgb]) ifTrue:[ |
|
637 |
convertMenu disable:#convertToGray4 |
|
638 |
] ifFalse:[ |
|
639 |
convertMenu disable:#convertToColor4 |
|
640 |
] |
|
641 |
]. |
|
642 |
image depth == 8 ifTrue:[ |
|
643 |
(image photometric ~~ #palette |
|
644 |
and:[image photometric ~~ #rgb]) ifTrue:[ |
|
645 |
convertMenu disable:#convertToGray8 |
|
646 |
] ifFalse:[ |
|
647 |
convertMenu disable:#convertToColor8 |
|
648 |
] |
|
649 |
]. |
|
650 |
image depth == 24 ifTrue:[ |
|
651 |
image photometric == #rgb ifTrue:[ |
|
652 |
convertMenu disable:#convertToColor24 |
|
653 |
] |
|
654 |
]. |
|
655 |
||
297 | 656 |
^ m |
657 |
||
26 | 658 |
" |
659 |
ImageEditView openOn:'bitmaps/SBrowser.xbm' |
|
660 |
ImageEditView openOn:'bitmaps/garfield.gif' |
|
661 |
" |
|
297 | 662 |
|
663 |
"Created: 20.2.1997 / 18:47:17 / cg" |
|
477 | 664 |
"Modified: 31.7.1997 / 11:41:26 / cg" |
1 | 665 |
! ! |
666 |
||
161 | 667 |
!ImageEditView methodsFor:'menu actions'! |
668 |
||
669 |
changeMagnification |
|
477 | 670 |
|b newMag| |
1 | 671 |
|
161 | 672 |
b := EnterBox new. |
673 |
b title:'magnification (magX @ magY)'. |
|
674 |
b okText:'apply'. |
|
675 |
b abortText:'abort'. |
|
477 | 676 |
b action:[:string | newMag := (Object readFromString:string onError:nil)]. |
161 | 677 |
b initialText:(magnification printString). |
477 | 678 |
b showAtPointer. |
404 | 679 |
|
477 | 680 |
newMag notNil ifTrue:[ |
681 |
antiAlias ifTrue:[ |
|
682 |
magnification := nil. |
|
683 |
]. |
|
684 |
antiAlias := false. |
|
685 |
self magnification:newMag. |
|
686 |
]. |
|
687 |
||
688 |
"Modified: 31.7.1997 / 11:43:12 / cg" |
|
404 | 689 |
! |
690 |
||
691 |
changeMagnificationAndAntiAlias |
|
477 | 692 |
|b newMag| |
404 | 693 |
|
694 |
b := EnterBox new. |
|
695 |
b title:'magnification (magX @ magY)'. |
|
696 |
b okText:'apply'. |
|
697 |
b abortText:'abort'. |
|
477 | 698 |
b action:[:string | newMag := (Object readFromString:string onError:nil)]. |
404 | 699 |
b initialText:(magnification printString). |
477 | 700 |
b showAtPointer. |
404 | 701 |
|
477 | 702 |
newMag notNil ifTrue:[ |
703 |
antiAlias ifFalse:[ |
|
704 |
magnification := nil. |
|
705 |
]. |
|
706 |
antiAlias := true. |
|
707 |
self magnification:newMag |
|
708 |
]. |
|
709 |
||
404 | 710 |
"Created: 2.6.1997 / 15:51:01 / cg" |
477 | 711 |
"Modified: 31.7.1997 / 11:43:47 / cg" |
161 | 712 |
! |
713 |
||
362 | 714 |
doPrint |
405 | 715 |
self doPrint:image |
716 |
||
717 |
"Modified: 2.6.1997 / 18:32:11 / cg" |
|
718 |
! |
|
719 |
||
720 |
doPrint:anImage |
|
362 | 721 |
|stream psgc| |
722 |
||
723 |
Printer supportsPostscript ifFalse:[ |
|
724 |
self warn:'need a postscript printer'. |
|
725 |
^ self |
|
726 |
]. |
|
727 |
||
728 |
stream := Printer newNative. |
|
729 |
stream isNil ifTrue:[ |
|
730 |
self warn:'cannot open printer stream'. |
|
731 |
^ nil |
|
732 |
]. |
|
733 |
||
398
7b7255a4db0d
show a wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
734 |
self withWaitCursorDo:[ |
7b7255a4db0d
show a wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
735 |
psgc := PSGraphicsContext on:stream. "/ extent:(1.0 @ 1.0). |
405 | 736 |
psgc displayForm:anImage x:0 y:0. |
398
7b7255a4db0d
show a wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
737 |
psgc close. |
7b7255a4db0d
show a wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
738 |
] |
362 | 739 |
|
398
7b7255a4db0d
show a wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
740 |
"Modified: 28.5.1997 / 10:54:11 / cg" |
405 | 741 |
"Created: 2.6.1997 / 18:32:03 / cg" |
742 |
! |
|
743 |
||
744 |
doPrintMagnified |
|
745 |
self doPrint:(magnifiedImage ? image) |
|
746 |
||
747 |
"Modified: 2.6.1997 / 18:31:54 / cg" |
|
362 | 748 |
! |
749 |
||
297 | 750 |
doSaveImageAs:anImage title:aTitle |
161 | 751 |
"save contents into a file |
752 |
- ask user for filename using a fileSelectionBox." |
|
753 |
||
606 | 754 |
|fileName imgFileName defaultName rdr i txt suffix| |
353 | 755 |
|
756 |
defaultName := pathName ? ''. |
|
757 |
||
758 |
pathName isNil ifTrue:[ |
|
606 | 759 |
suffix := 'tiff'. |
760 |
(imgFileName := image fileName) notNil ifTrue:[ |
|
761 |
suffix := imgFileName asFilename suffix. |
|
762 |
defaultName := imgFileName asFilename baseName |
|
763 |
] |
|
353 | 764 |
] ifFalse:[ |
765 |
suffix := pathName asFilename suffix. |
|
766 |
"/ a supported suffix ? |
|
767 |
((rdr := Image imageReaderClassForSuffix:suffix) isNil |
|
768 |
or:[(rdr canRepresent:anImage) not]) ifTrue:[ |
|
769 |
suffix := 'tiff'. |
|
770 |
defaultName := (pathName asFilename withSuffix:suffix) pathName |
|
771 |
]. |
|
772 |
]. |
|
251 | 773 |
|
606 | 774 |
Image cannotRepresentImageSignal handle:[:ex | |
775 |
self warn:('cannot represent this image in that format.\\(%1)' bindWith:ex errorString) withCRs. |
|
776 |
fileName := nil. |
|
777 |
ex restart |
|
778 |
] do:[ |
|
779 |
fileName := Dialog |
|
780 |
requestFileName:(resources string:aTitle) |
|
781 |
default:defaultName |
|
782 |
ok:(resources string:'save') |
|
783 |
abort:(resources string:'abort') |
|
784 |
pattern:('*.' , suffix). |
|
161 | 785 |
|
606 | 786 |
fileName notNil ifTrue:[ |
787 |
anImage saveOn:fileName. |
|
788 |
]. |
|
161 | 789 |
]. |
606 | 790 |
pathName := fileName. |
251 | 791 |
|
606 | 792 |
"Created: / 20.2.1997 / 18:52:08 / cg" |
793 |
"Modified: / 3.11.1997 / 15:02:27 / cg" |
|
297 | 794 |
! |
795 |
||
796 |
saveAs |
|
797 |
"save contents into a file |
|
798 |
- ask user for filename using a fileSelectionBox." |
|
799 |
||
800 |
self doSaveImageAs:image title:'save image in:' |
|
801 |
||
802 |
"Modified: 20.2.1997 / 18:52:37 / cg" |
|
803 |
! |
|
804 |
||
805 |
saveMagnifiedAs |
|
806 |
"save contents into a file |
|
807 |
- ask user for filename using a fileSelectionBox." |
|
808 |
||
809 |
self doSaveImageAs:magnifiedImage title:'save magnified image in:' |
|
810 |
||
811 |
"Created: 20.2.1997 / 18:52:53 / cg" |
|
812 |
! |
|
813 |
||
814 |
saveMagnifiedMaskAs |
|
815 |
"save contents into a file |
|
816 |
- ask user for filename using a fileSelectionBox." |
|
817 |
||
818 |
self doSaveImageAs:(magnifiedImage mask) title:'save magnified mask in:' |
|
819 |
||
820 |
"Created: 20.2.1997 / 18:53:31 / cg" |
|
821 |
"Modified: 20.2.1997 / 18:56:48 / cg" |
|
822 |
! |
|
823 |
||
824 |
saveMaskAs |
|
825 |
"save contents into a file |
|
826 |
- ask user for filename using a fileSelectionBox." |
|
827 |
||
828 |
self doSaveImageAs:(image mask) title:'save mask in:' |
|
829 |
||
830 |
"Created: 20.2.1997 / 18:51:06 / cg" |
|
831 |
"Modified: 20.2.1997 / 18:56:54 / cg" |
|
1 | 832 |
! |
833 |
||
161 | 834 |
showColors |
835 |
colorPanel isNil ifTrue:[ |
|
353 | 836 |
colorPanel := ColorPanel new |
1 | 837 |
]. |
161 | 838 |
colorPanel shown ifFalse:[ |
353 | 839 |
colorPanel open |
161 | 840 |
] |
353 | 841 |
|
842 |
"Modified: 10.4.1997 / 17:22:35 / cg" |
|
1 | 843 |
! ! |
844 |
||
161 | 845 |
!ImageEditView methodsFor:'queries'! |
5 | 846 |
|
161 | 847 |
heightOfContents |
848 |
"return the images height" |
|
849 |
||
850 |
image isNil ifTrue:[^ 0]. |
|
851 |
^ (image height * magnification y) rounded |
|
5 | 852 |
! |
853 |
||
161 | 854 |
widthOfContents |
855 |
"return the images width" |
|
5 | 856 |
|
161 | 857 |
image isNil ifTrue:[^ 0]. |
858 |
^ (image width * magnification x) rounded |
|
5 | 859 |
! ! |
860 |
||
1 | 861 |
!ImageEditView methodsFor:'release'! |
862 |
||
863 |
destroy |
|
864 |
colors := nil. |
|
865 |
magnifiedImage := nil. |
|
866 |
colorPanel notNil ifTrue:[ |
|
26 | 867 |
colorPanel destroy. |
868 |
colorPanel := nil. |
|
1 | 869 |
]. |
870 |
super destroy. |
|
871 |
! ! |
|
161 | 872 |
|
255 | 873 |
!ImageEditView class methodsFor:'documentation'! |
161 | 874 |
|
875 |
version |
|
606 | 876 |
^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.47 1997-11-03 15:19:36 cg Exp $' |
161 | 877 |
! ! |