author | Claus Gittinger <cg@exept.de> |
Mon, 11 Dec 2000 11:33:13 +0100 | |
changeset 1903 | b0c9fcf3155e |
parent 1901 | b4b286ec221f |
child 1957 | 9a4347986d96 |
permissions | -rw-r--r-- |
636 | 1 |
" |
704 | 2 |
COPYRIGHT (c) 1997 by eXept Software AG |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
3 |
All Rights Reserved |
636 | 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 |
||
1763
7d6d64622ee4
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1706
diff
changeset
|
13 |
"{ Package: 'stx:libwidg2' }" |
7d6d64622ee4
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1706
diff
changeset
|
14 |
|
1 | 15 |
ImageView subclass:#ImageEditView |
1246 | 16 |
instanceVariableNames:'magnification imageReaderClass resourceClass resourceSelector |
17 |
mouseKeyColorMode undoImages modified masterApplication editMode |
|
18 |
lastPastePoint imageInfoHolder activityInfoHolder |
|
1693 | 19 |
pickedColorHolder drawingColors drawingPixels clickInfoCallBack' |
1035 | 20 |
classVariableNames:'Clipboard LastMagnification ClipboardMagnification |
1706 | 21 |
GridMagnificationLimit MaxUndos' |
1035 | 22 |
poolDictionaries:'' |
1706 | 23 |
category:'Views-Misc' |
1 | 24 |
! |
25 |
||
636 | 26 |
!ImageEditView class methodsFor:'documentation'! |
27 |
||
28 |
copyright |
|
29 |
" |
|
704 | 30 |
COPYRIGHT (c) 1997 by eXept Software AG |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
31 |
All Rights Reserved |
636 | 32 |
|
33 |
This software is furnished under a license and may be used |
|
34 |
only in accordance with the terms of that license and with the |
|
35 |
inclusion of the above copyright notice. This software may not |
|
36 |
be provided or otherwise made available to, or used by, any |
|
37 |
other person. No title to or ownership of the software is |
|
38 |
hereby transferred. |
|
39 |
" |
|
40 |
! |
|
41 |
||
42 |
documentation |
|
43 |
" |
|
44 |
The ImageEditView is a view class which can be used by applications |
|
45 |
like the Image Editor for modifying or inspecting images. |
|
46 |
||
47 |
[see also:] |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
48 |
ImageEditor Image |
636 | 49 |
|
50 |
[author:] |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
51 |
Thomas Zwick |
636 | 52 |
" |
53 |
! ! |
|
353 | 54 |
|
1245 | 55 |
!ImageEditView class methodsFor:'initialization'! |
56 |
||
57 |
initialize |
|
58 |
MaxUndos := 5. |
|
1706 | 59 |
GridMagnificationLimit := 8 @ 8. |
1245 | 60 |
|
61 |
" |
|
62 |
self initialize |
|
63 |
" |
|
64 |
! ! |
|
65 |
||
1706 | 66 |
!ImageEditView class methodsFor:'accessing'! |
67 |
||
68 |
gridMagnificationLimit |
|
69 |
^ GridMagnificationLimit |
|
70 |
! |
|
71 |
||
72 |
gridMagnificationLimit:anInteger |
|
73 |
GridMagnificationLimit := anInteger |
|
74 |
! ! |
|
75 |
||
1882
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
76 |
!ImageEditView class methodsFor:'utilities'! |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
77 |
|
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
78 |
generateImageSpecMethodFor:anImage comment:comment inClass:aClass selector:sel |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
79 |
|imageStoreStream mthd imageKey category| |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
80 |
|
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
81 |
anImage storeOn: (imageStoreStream := WriteStream on: ''). |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
82 |
|
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
83 |
"/ if that method already exists, do not overwrite the category |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
84 |
category := 'image specs'. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
85 |
(mthd := aClass compiledMethodAt:sel) notNil ifTrue:[ |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
86 |
category := mthd category. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
87 |
]. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
88 |
|
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
89 |
imageKey := (aClass name, ' ', sel) asSymbol. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
90 |
Icon constantNamed: imageKey put:nil. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
91 |
aClass |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
92 |
compile: ((sel, |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
93 |
'\', comment, |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
94 |
'\\' , |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
95 |
' "\', |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
96 |
' self ' , sel , ' inspect\', |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
97 |
' ImageEditor openOnClass:self andSelector:#', sel, |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
98 |
'\ "', |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
99 |
'\\', |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
100 |
' <resource: #image>', |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
101 |
'\\', |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
102 |
' ^Icon\') withCRs, |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
103 |
' constantNamed:#''', imageKey, '''\' withCRs, |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
104 |
' ifAbsentPut:[', imageStoreStream contents, ']') |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
105 |
classified: category. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
106 |
! ! |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
107 |
|
7 | 108 |
!ImageEditView methodsFor:'accessing'! |
109 |
||
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
110 |
activityInfoHolder |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
111 |
"return the value of the instance variable 'activityInfoHolder' (automatically generated)" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
112 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
113 |
^ activityInfoHolder |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
114 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
115 |
"Created: / 29.7.1998 / 18:49:39 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
116 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
117 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
118 |
activityInfoHolder:something |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
119 |
"set the value of the instance variable 'activityInfoHolder' (automatically generated)" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
120 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
121 |
activityInfoHolder := something. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
122 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
123 |
"Created: / 29.7.1998 / 18:49:39 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
124 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
125 |
|
1693 | 126 |
clickInfoCallBack:aTwoArgBlock |
127 |
clickInfoCallBack := aTwoArgBlock |
|
128 |
||
129 |
"Created: / 10.2.2000 / 23:07:14 / cg" |
|
130 |
! |
|
131 |
||
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
132 |
imageInfoHolder |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
133 |
"return the value of the instance variable 'imageInfoHolder' (automatically generated)" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
134 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
135 |
^ imageInfoHolder |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
136 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
137 |
"Created: / 29.7.1998 / 18:29:50 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
138 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
139 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
140 |
imageInfoHolder:something |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
141 |
"set the value of the instance variable 'imageInfoHolder' (automatically generated)" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
142 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
143 |
imageInfoHolder := something. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
144 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
145 |
"Created: / 29.7.1998 / 18:29:50 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
146 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
147 |
|
624 | 148 |
magnification |
149 |
||
150 |
^magnification |
|
151 |
||
255 | 152 |
! |
153 |
||
636 | 154 |
magnification: aPoint |
1037 | 155 |
|oldOrg| |
255 | 156 |
|
627 | 157 |
magnification ~= aPoint |
624 | 158 |
ifTrue: |
159 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
160 |
oldOrg := self viewOrigin / magnification. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
161 |
magnification := aPoint asPoint. |
1037 | 162 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
163 |
self scrollTo:(oldOrg * magnification) rounded redraw:false. |
1037 | 164 |
"/ self scrollToTopLeft. |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
165 |
self contentsChanged. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
166 |
self invalidate. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
167 |
ClipboardMagnification := nil. |
686 | 168 |
] |
1037 | 169 |
|
170 |
"Modified: / 31.7.1998 / 02:38:47 / cg" |
|
624 | 171 |
! |
255 | 172 |
|
662 | 173 |
masterApplication |
174 |
||
175 |
^masterApplication |
|
176 |
! |
|
177 |
||
178 |
masterApplication: anApplicationModel |
|
179 |
||
180 |
masterApplication := anApplicationModel |
|
181 |
! |
|
182 |
||
627 | 183 |
resourceClass |
184 |
||
185 |
^resourceClass |
|
186 |
! |
|
187 |
||
188 |
resourceClass: aClassOrSymbol |
|
189 |
||
686 | 190 |
resourceClass := aClassOrSymbol isClass ifTrue: [aClassOrSymbol name] ifFalse: [aClassOrSymbol asSymbol] |
627 | 191 |
! |
192 |
||
193 |
resourceMessage |
|
194 |
||
195 |
^resourceClass, ' ', resourceSelector |
|
196 |
! |
|
197 |
||
636 | 198 |
resourceMessage: aString |
627 | 199 |
|
636 | 200 |
(aString isString and: [aString trimBlanks size > 0]) |
627 | 201 |
ifTrue: |
202 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
203 |
resourceClass := (aString readStream upTo: Character space) asSymbol. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
204 |
resourceSelector := (aString copy reverse readStream upTo: Character space) reverse asSymbol |
627 | 205 |
] |
206 |
ifFalse: |
|
207 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
208 |
^nil |
686 | 209 |
] |
627 | 210 |
|
211 |
||
212 |
! |
|
213 |
||
214 |
resourceSelector |
|
215 |
||
216 |
^resourceSelector |
|
217 |
! |
|
218 |
||
219 |
resourceSelector: aStringOrSymbol |
|
220 |
||
221 |
resourceSelector := aStringOrSymbol asSymbol |
|
222 |
! |
|
223 |
||
840 | 224 |
selectColors |
225 |
||
1246 | 226 |
^drawingColors |
840 | 227 |
! |
228 |
||
229 |
selectColors: anArrayTwoColors |
|
633 | 230 |
|
1246 | 231 |
drawingColors := anArrayTwoColors |
633 | 232 |
! |
233 |
||
627 | 234 |
selectedColor |
235 |
||
1246 | 236 |
^drawingColors at: mouseKeyColorMode |
237 |
! |
|
238 |
||
239 |
selectedColor: aColor |
|
240 |
||
241 |
drawingColors at: mouseKeyColorMode put: aColor |
|
627 | 242 |
! |
243 |
||
1246 | 244 |
selectedColorIndex |
627 | 245 |
|
1246 | 246 |
^ drawingPixels at: mouseKeyColorMode |
247 |
! |
|
248 |
||
249 |
selectedColorIndex: aPixelIndex |
|
250 |
||
251 |
drawingPixels at: mouseKeyColorMode put: aPixelIndex |
|
995 | 252 |
! |
253 |
||
254 |
undoImages |
|
255 |
||
256 |
^undoImages |
|
627 | 257 |
! ! |
258 |
||
259 |
!ImageEditView methodsFor:'drawing'! |
|
260 |
||
1036 | 261 |
drawFrame |
262 |
||
263 |
self paint:Color black. |
|
264 |
self lineWidth: (magnification x//3 min: 3). |
|
1104 | 265 |
self displayRectangle: ((0@0) extent:(image extent * magnification) + margin). |
1036 | 266 |
self lineWidth:1. |
267 |
! |
|
268 |
||
269 |
drawFramesIn: aRectangle |
|
270 |
||
1706 | 271 |
magnification >= GridMagnificationLimit |
1036 | 272 |
ifTrue: |
273 |
[ |
|
1706 | 274 |
|origin lineStartingPoint lineEndingPoint oldColor| |
275 |
origin := aRectangle origin - 1. |
|
276 |
lineStartingPoint := origin + (0@magnification y). |
|
277 |
lineEndingPoint := lineStartingPoint + (aRectangle width@0). |
|
278 |
oldColor := self paint. |
|
279 |
self xoring: |
|
280 |
[ |
|
281 |
self displayLineFrom: lineStartingPoint to: lineEndingPoint. |
|
282 |
lineStartingPoint x to: lineStartingPoint x + aRectangle width - magnification x by: magnification x do: |
|
283 |
[:x| |
|
284 |
self displayLineFrom: x@(origin y) to: x@(origin y + magnification y) |
|
285 |
]. |
|
286 |
]. |
|
287 |
self paint: oldColor. |
|
1036 | 288 |
] |
289 |
||
290 |
||
291 |
||
292 |
! |
|
293 |
||
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
294 |
drawPasteRectangleAt: aPoint |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
295 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
296 |
|currentPoint gridCorrection extent org| |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
297 |
|
1706 | 298 |
magnification >= GridMagnificationLimit ifFalse: [gridCorrection := 0] ifTrue: [gridCorrection := 1]. |
1449 | 299 |
currentPoint := aPoint // magnification*magnification + margin. |
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
300 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
301 |
currentPoint ~= lastPastePoint ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
302 |
ClipboardMagnification isNil ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
303 |
ClipboardMagnification := (Clipboard magnifiedBy: magnification) onDevice: device |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
304 |
]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
305 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
306 |
extent := ClipboardMagnification extent. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
307 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
308 |
currentPoint := currentPoint - self viewOrigin. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
309 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
310 |
self redraw: ((lastPastePoint ? currentPoint) extent: extent). |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
311 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
312 |
(extent x > 200 or: [extent y > 200]) ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
313 |
self xoring: [ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
314 |
self fillRectangle: (currentPoint extent: extent) |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
315 |
] |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
316 |
] ifFalse:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
317 |
self displayDeviceForm: ClipboardMagnification x: currentPoint x y: currentPoint y. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
318 |
editMode == #pasteUnder ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
319 |
self redrawImageX:currentPoint x y:currentPoint y width:extent x height:extent y unmaskedOnly:true |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
320 |
] |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
321 |
] |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
322 |
]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
323 |
lastPastePoint := currentPoint. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
324 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
325 |
"Modified: / 18.5.1999 / 20:23:33 / cg" |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
326 |
! |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
327 |
|
662 | 328 |
fillFramedRectangle: aRectangle |
329 |
||
330 |
self fillRectangle: aRectangle. |
|
331 |
self drawFramesIn: aRectangle |
|
332 |
! |
|
333 |
||
1449 | 334 |
redraw:aRectangle |
335 |
super redraw:(aRectangle origin + self viewOrigin extent:aRectangle extent). |
|
336 |
||
337 |
! |
|
338 |
||
627 | 339 |
redrawImageX:x y:y width:w height:h |
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
340 |
self redrawImageX:x y:y width:w height:h unmaskedOnly:false |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
341 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
342 |
"Modified: / 18.5.1999 / 20:14:03 / cg" |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
343 |
! |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
344 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
345 |
redrawImageX:x y:y width:w height:h unmaskedOnly:unmaskedOnly |
636 | 346 |
|
1037 | 347 |
|ih iw magX magY minX maxX minY maxY |
348 |
color lastColor lastY runW x0 xI yI maskColor mask |
|
1180 | 349 |
sizeOfMaskPoint useNearestColor| |
350 |
||
351 |
useNearestColor := device visualType == #PseudoColor. |
|
627 | 352 |
|
1037 | 353 |
mask := image mask. |
627 | 354 |
ih := image height. |
355 |
iw := image width. |
|
662 | 356 |
magX := magnification x. |
357 |
magY := magnification y. |
|
627 | 358 |
|
662 | 359 |
minX := (x // magX - 1) max: 0. |
725 | 360 |
minX >= iw ifTrue:[minX := (iw - 1) max: 0]. |
662 | 361 |
minY := (y // magY - 1) max: 0. |
725 | 362 |
minY >= ih ifTrue:[minY := (ih - 1) max: 0]. |
662 | 363 |
maxX := (x + w) // magX + 1. |
627 | 364 |
maxX > iw ifTrue:[maxX := iw]. |
662 | 365 |
maxY := (y + h) // magY + 1. |
627 | 366 |
maxY > ih ifTrue:[maxY := ih]. |
367 |
||
368 |
lastY := -1. |
|
369 |
||
370 |
x0 := minX. |
|
371 |
runW := 0. |
|
372 |
maskColor := false. |
|
662 | 373 |
sizeOfMaskPoint := magnification//3. |
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
374 |
image |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
375 |
colorsFromX:minX y:minY toX:maxX-1 y:maxY-1 |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
376 |
do:[:xx :yy :color| |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
377 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
378 |
shown ifFalse:[^ self]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
379 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
380 |
yy ~~ lastY ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
381 |
runW ~~ 0 ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
382 |
|origin| |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
383 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
384 |
origin := (x0 * magX + margin)@(lastY * magY + margin). |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
385 |
(unmaskedOnly not or:[maskColor not]) ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
386 |
self fillFramedRectangle: (origin extent: (runW@magY)). |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
387 |
maskColor ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
388 |
self xoring: [self fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)] |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
389 |
] |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
390 |
]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
391 |
runW := 0. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
392 |
]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
393 |
x0 := xx. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
394 |
lastY := yy. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
395 |
]. |
1160 | 396 |
|
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
397 |
color ~= lastColor ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
398 |
runW ~~ 0 ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
399 |
|origin| |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
400 |
origin := (x0 * magX + margin)@(yy * magY + margin). |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
401 |
(unmaskedOnly not or:[maskColor not]) ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
402 |
self fillFramedRectangle: (origin extent: (runW@magY)). |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
403 |
maskColor ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
404 |
self xoring: [self fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)] |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
405 |
]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
406 |
]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
407 |
runW := 0. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
408 |
]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
409 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
410 |
lastColor := color. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
411 |
useNearestColor ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
412 |
lastColor := lastColor nearestOn:device |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
413 |
]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
414 |
self paint:lastColor. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
415 |
mask notNil ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
416 |
maskColor := false. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
417 |
(mask pixelAtX:xx y:yy) == 0 ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
418 |
unmaskedOnly ifFalse:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
419 |
self paint: (lastColor := self viewBackground). |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
420 |
]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
421 |
maskColor := true. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
422 |
]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
423 |
lastColor := nil. |
1160 | 424 |
]. |
425 |
runW := 0. |
|
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
426 |
x0 := xx. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
427 |
]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
428 |
runW := runW + magX |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
429 |
]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
430 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
431 |
runW ~~ 0 ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
432 |
|origin| |
624 | 433 |
|
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
434 |
origin := (x0 * magX + margin)@(lastY * magY + margin). |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
435 |
(unmaskedOnly not or:[maskColor not]) ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
436 |
self fillFramedRectangle: (origin extent: runW@magY). |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
437 |
maskColor ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
438 |
self xoring:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
439 |
self fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint) |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
440 |
] |
1180 | 441 |
]. |
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
442 |
] |
627 | 443 |
]. |
1037 | 444 |
|
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
445 |
"Created: / 18.5.1999 / 20:13:39 / cg" |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
446 |
"Modified: / 18.5.1999 / 20:36:20 / cg" |
627 | 447 |
! |
448 |
||
449 |
redrawX:x y:y width:w height:h |
|
636 | 450 |
|
1763
7d6d64622ee4
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1706
diff
changeset
|
451 |
|ih iw xI yI devImage| |
627 | 452 |
|
1037 | 453 |
image isNil ifTrue:[^self]. |
662 | 454 |
|
1037 | 455 |
magnification = (1@1) ifTrue: [ |
1510
fd0cd6065dc6
catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
456 |
Object errorSignal handle:[:ex | |
fd0cd6065dc6
catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
457 |
Transcript showCR:'cannot convert image'. |
fd0cd6065dc6
catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
458 |
] do:[ |
1763
7d6d64622ee4
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1706
diff
changeset
|
459 |
devImage := image onDevice:device. |
7d6d64622ee4
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1706
diff
changeset
|
460 |
devImage ~~ image ifTrue:[ |
7d6d64622ee4
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1706
diff
changeset
|
461 |
image := devImage. |
1764 | 462 |
self changed:#image. |
1763
7d6d64622ee4
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1706
diff
changeset
|
463 |
]. |
1510
fd0cd6065dc6
catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
464 |
]. |
fd0cd6065dc6
catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
465 |
image device == device ifTrue:[ |
fd0cd6065dc6
catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
466 |
^ super redrawX:x y:y width:w height:h |
fd0cd6065dc6
catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
467 |
]. |
1037 | 468 |
]. |
627 | 469 |
|
1449 | 470 |
self clippingRectangle: (x@y extent:w@h). |
627 | 471 |
|
472 |
self redrawImageX:x y:y width:w height:h. |
|
473 |
||
474 |
"/ right of image ? |
|
475 |
adjust == #center ifTrue: |
|
476 |
[ |
|
1449 | 477 |
xI := (width - ih) // 2 - margin. |
478 |
yI := (height - iw) // 2 - margin. |
|
627 | 479 |
] |
480 |
ifFalse: |
|
481 |
[ |
|
1449 | 482 |
xI := yI := margin |
627 | 483 |
]. |
484 |
(x + w - 1) > (xI + (magnification x * image width)) ifTrue: |
|
485 |
[ |
|
1449 | 486 |
self clearRectangleX:(xI + (magnification x * image width)) |
487 |
y:y |
|
488 |
width:(x + w - (magnification x * image width) - xI) |
|
489 |
height:h |
|
627 | 490 |
]. |
491 |
(y + h - 1) > (yI + (magnification y * image height)) ifTrue: |
|
492 |
[ |
|
1449 | 493 |
self clearRectangleX:margin |
494 |
y:(yI + (magnification y * image height)) |
|
495 |
width:w |
|
496 |
height:(y + h - (magnification y * image height) - yI) |
|
627 | 497 |
]. |
498 |
self drawFrame. |
|
499 |
self clippingRectangle: nil. |
|
1037 | 500 |
|
501 |
"Modified: / 31.7.1998 / 02:22:45 / cg" |
|
627 | 502 |
! ! |
503 |
||
504 |
!ImageEditView methodsFor:'edit modes'! |
|
505 |
||
506 |
editMode |
|
507 |
||
1106 | 508 |
^editMode |
627 | 509 |
! |
510 |
||
1106 | 511 |
editMode: anEditMode |
627 | 512 |
|
1106 | 513 |
editMode := anEditMode |
627 | 514 |
! |
515 |
||
516 |
mouseKeyColorMode |
|
517 |
||
518 |
^mouseKeyColorMode printString |
|
519 |
! |
|
520 |
||
521 |
mouseKeyColorMode:aMode |
|
522 |
||
1106 | 523 |
mouseKeyColorMode := aMode |
627 | 524 |
! ! |
525 |
||
526 |
!ImageEditView methodsFor:'event handling'! |
|
527 |
||
528 |
buttonMotion:state x:x y:y |
|
1246 | 529 |
|
1693 | 530 |
|p| |
531 |
||
532 |
p := x@y. |
|
533 |
||
534 |
state ~~ 0 ifTrue:[ |
|
1245 | 535 |
("self selectedColor notNil" true |
1693 | 536 |
and:[(self imageContainsPoint:p) |
537 |
and:[editMode == #point]]) |
|
538 |
ifTrue:[ |
|
539 |
self pointAt:p. |
|
1246 | 540 |
^ self |
541 |
]. |
|
1693 | 542 |
self drawCursorAt:p. |
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
543 |
] ifFalse:[ |
1693 | 544 |
self drawCursorAt:p. |
1246 | 545 |
(editMode == #paste or:[editMode == #pasteUnder]) ifTrue: [ |
1693 | 546 |
("self selectedColor notNil" true and: [self imageContainsPastePoint:p]) |
547 |
ifTrue: [self drawPasteRectangleAt:p] |
|
1245 | 548 |
ifFalse: [self cursor:Cursor stop. self releasePasteDrawing] |
549 |
] |
|
686 | 550 |
] |
1019
e68414752bc9
only change the cursor for myself.
Claus Gittinger <cg@exept.de>
parents:
1013
diff
changeset
|
551 |
|
1693 | 552 |
"Modified: / 10.2.2000 / 22:03:18 / cg" |
624 | 553 |
! |
255 | 554 |
|
627 | 555 |
buttonPress:button x:x y:y |
1693 | 556 |
|p mouseButtonColorToolBar clr| |
627 | 557 |
|
1693 | 558 |
p := x@y. |
559 |
||
560 |
self drawCursorAt:p. |
|
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
561 |
|
1246 | 562 |
("self selectedColor notNil" true |
1693 | 563 |
and: [self imageContainsPoint:p]) |
1246 | 564 |
ifTrue:[ |
565 |
self sensor shiftDown ifTrue:[ |
|
566 |
pickedColorHolder notNil ifTrue:[ |
|
567 |
"/ select the color under the cursor, place it into the |
|
568 |
"/ pickedColorHolder/ |
|
1693 | 569 |
clr := image colorAt:(p // magnification). |
1246 | 570 |
pickedColorHolder value:clr |
571 |
]. |
|
572 |
] ifFalse:[ |
|
573 |
mouseKeyColorMode := button. |
|
574 |
self makeUndo. |
|
1693 | 575 |
|
576 |
"/ "/ cg: what a kludge - please change to use a valueHolder, |
|
577 |
"/ "/ which gets the information ... |
|
578 |
"/ mouseButtonColorToolBar := masterApplication builder componentAt: #MouseButtonColorToolBar. |
|
579 |
"/ mouseButtonColorToolBar notNil ifTrue:[ |
|
580 |
"/ (mouseButtonColorToolBar itemAt: mouseKeyColorMode) toggleIndication. |
|
581 |
"/ mouseButtonColorToolBar do: [:i| i updateIndicators]. |
|
582 |
"/ ]. |
|
583 |
||
584 |
clickInfoCallBack notNil ifTrue:[ |
|
585 |
"/ still a kludge, but less ugly ... |
|
586 |
clickInfoCallBack value:button value:p |
|
587 |
]. |
|
1246 | 588 |
"/ editMode is something like #point, #rectangle etc. |
1693 | 589 |
self perform: (editMode, 'At:') asSymbol with:p |
1246 | 590 |
] |
686 | 591 |
] |
995 | 592 |
|
1693 | 593 |
"Modified: / 10.2.2000 / 23:11:33 / cg" |
632 | 594 |
! |
595 |
||
994
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
596 |
buttonRelease:button x:x y:y |
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
597 |
|
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
598 |
self drawCursorAt: x@y. |
1246 | 599 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
600 |
("self selectedColor notNil" true and: [self imageContainsPoint: x@y]) |
1246 | 601 |
ifTrue: [ |
1763
7d6d64622ee4
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1706
diff
changeset
|
602 |
image release. |
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
603 |
|
1693 | 604 |
"/ "/ cg: what a kludge - please change to use a valueHolder, |
605 |
"/ "/ which gets the information ... |
|
606 |
"/ masterApplication imagePreView invalidate. |
|
607 |
||
608 |
"/ cg: still a kludge - but less ugly |
|
609 |
self changed:#subImageIn with:(image bounds). |
|
994
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
610 |
] |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
611 |
|
1693 | 612 |
"Modified: / 10.2.2000 / 23:41:41 / cg" |
994
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
613 |
! |
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
614 |
|
686 | 615 |
pointerLeave:state |
616 |
||
688 | 617 |
super pointerLeave: state. |
686 | 618 |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
619 |
self updateImageInfo: self imageInfoString. |
1019
e68414752bc9
only change the cursor for myself.
Claus Gittinger <cg@exept.de>
parents:
1013
diff
changeset
|
620 |
self cursor:Cursor normal. |
995 | 621 |
|
1246 | 622 |
(editMode == #paste or:[editMode == #pasteUnder]) ifTrue: [ |
623 |
self releasePasteDrawing |
|
624 |
] |
|
995 | 625 |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
626 |
"Modified: / 29.7.1998 / 18:27:42 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
627 |
! ! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
628 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
629 |
!ImageEditView methodsFor:'image - dragging & info'! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
630 |
|
1449 | 631 |
dragRectangleStartingAt: aPointIn emphasis: emphasis |
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
632 |
"drag a rectangle (filled or unfilled)" |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
633 |
|
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
634 |
|currentPoint currentExtent firstPoint lastCurrentPoint gridCorrection |
1449 | 635 |
mp lastMp p whichQuarter scrollX scrollY aPoint| |
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
636 |
|
1693 | 637 |
aPoint := aPointIn. |
638 |
firstPoint := currentPoint := lastCurrentPoint := aPoint//magnification*magnification. |
|
1706 | 639 |
magnification >= GridMagnificationLimit ifFalse: [gridCorrection := 0] ifTrue: [gridCorrection := 1]. |
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
640 |
|
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
641 |
[device anyButtonPressed] whileTrue: [ |
1449 | 642 |
mp := self sensor mousePoint. |
643 |
mp = lastMp ifTrue:[ |
|
644 |
Delay waitForSeconds:0.05 |
|
645 |
] ifFalse:[ |
|
646 |
lastMp := mp. |
|
647 |
mp := device translatePoint:mp from:device rootView id to:self id. |
|
1693 | 648 |
"/ mp is a device coordinate here ... |
1449 | 649 |
scrollX := 0. |
650 |
mp x > width ifTrue:[ |
|
651 |
scrollX := mp x - width. |
|
652 |
] ifFalse:[ |
|
653 |
mp x < 0 ifTrue:[ |
|
654 |
scrollX := mp x. |
|
655 |
] |
|
656 |
]. |
|
657 |
scrollY := 0. |
|
658 |
mp y > height ifTrue:[ |
|
659 |
scrollY := mp y - height. |
|
660 |
] ifFalse:[ |
|
661 |
mp y < 0 ifTrue:[ |
|
662 |
scrollY := mp y. |
|
663 |
] |
|
664 |
]. |
|
665 |
(scrollX + scrollY) ~~ 0 ifTrue:[ |
|
666 |
self scrollTo:(self viewOrigin + (scrollX @ scrollY)). |
|
667 |
lastMp := nil. |
|
668 |
]. |
|
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
669 |
|
1693 | 670 |
mp := mp + self viewOrigin. |
671 |
"/ mp is now a logical coordinate. |
|
672 |
||
673 |
currentPoint := (0@0) max: (image extent * magnification min: (p := mp)). |
|
1449 | 674 |
currentPoint := currentPoint//magnification*magnification. |
675 |
currentExtent := (firstPoint - currentPoint) abs. |
|
676 |
whichQuarter := (firstPoint x - currentPoint x) > 0 |
|
677 |
ifTrue: [(firstPoint y - currentPoint y) > 0 ifTrue: ["4"1@1] ifFalse: ["3"1@0]] |
|
678 |
ifFalse: [(firstPoint y - currentPoint y) > 0 ifTrue: ["1"0@1] ifFalse: ["2"0@0]]. |
|
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
679 |
|
1449 | 680 |
self drawCursorAt: p withLabel: |
681 |
((firstPoint//magnification - whichQuarter + 1) printString, |
|
682 |
' to: ', |
|
683 |
(currentPoint//magnification + whichQuarter) printString), |
|
684 |
' (extent: ', |
|
685 |
(currentExtent//magnification) printString, ')'. |
|
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
686 |
|
1693 | 687 |
currentPoint ~= lastCurrentPoint ifTrue:[ |
688 |
emphasis = #inverseFilledBox ifTrue: [ |
|
1449 | 689 |
self redraw: ((firstPoint min: lastCurrentPoint) - 1 extent: (firstPoint - lastCurrentPoint) abs + 2). |
690 |
self xoring: [self fillRectangle: ((firstPoint min: currentPoint) + margin extent: currentExtent - gridCorrection)] |
|
691 |
]. |
|
692 |
emphasis = #box |
|
1693 | 693 |
ifTrue:[ |
1449 | 694 |
|origin extent lineWidthY lineWidthX| |
695 |
origin := (firstPoint min: lastCurrentPoint) - 1. |
|
696 |
extent := (firstPoint - lastCurrentPoint) abs + 2. |
|
697 |
lineWidthY := extent y min: (magnification y + 2). |
|
698 |
lineWidthX := extent x min: (magnification x + 2). |
|
699 |
self redraw: (origin extent: (extent x@lineWidthY)). |
|
700 |
self redraw: ((origin x@(origin y + extent y - lineWidthY)) extent: (extent x@lineWidthY)). |
|
701 |
self redraw: ((origin x@(origin y + lineWidthY)) extent: (lineWidthX@(0 max: (extent y - (lineWidthY * 2))))). |
|
702 |
self redraw: (((origin x + extent x - lineWidthX)@(origin y + lineWidthY)) extent: (lineWidthX@(extent y - (lineWidthY * 2)))). |
|
703 |
self selectedColor ~= Color noColor |
|
704 |
ifTrue: [self paint: self selectedColor] |
|
705 |
ifFalse: [self paint: self viewBackground]. |
|
706 |
origin := (firstPoint min: currentPoint) + margin. |
|
707 |
extent := currentExtent - gridCorrection. |
|
708 |
lineWidthY := extent y min: magnification y. |
|
709 |
lineWidthX := extent x min: magnification x. |
|
710 |
(lineWidthY > 0 and: [lineWidthX > 0]) |
|
1693 | 711 |
ifTrue:[ |
1449 | 712 |
self fillRectangle: (origin extent: (extent x@lineWidthY)). |
713 |
self fillRectangle: ((origin x@(origin y + extent y - lineWidthY)) extent: (extent x@lineWidthY)). |
|
714 |
self fillRectangle: ((origin x@(origin y + lineWidthY)) extent: (lineWidthX@(0 max: (extent y - (lineWidthY * 2))))). |
|
715 |
self fillRectangle: (((origin x + extent x - lineWidthX)@(origin y + lineWidthY)) extent: (lineWidthX@(extent y - (lineWidthY * 2)))). |
|
716 |
] |
|
717 |
]. |
|
718 |
emphasis = #filledBox |
|
1693 | 719 |
ifTrue:[ |
1449 | 720 |
self redraw: ((firstPoint min: lastCurrentPoint) - 1 extent: (firstPoint - lastCurrentPoint) abs + 2). |
721 |
self selectedColor ~= Color noColor |
|
722 |
ifTrue: [self paint: self selectedColor] |
|
723 |
ifFalse: [self paint: self viewBackground]. |
|
724 |
self fillRectangle: ((firstPoint min: currentPoint) + margin extent: currentExtent - gridCorrection). |
|
725 |
]. |
|
726 |
]. |
|
727 |
lastCurrentPoint := currentPoint. |
|
728 |
]. |
|
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
729 |
]. |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
730 |
|
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
731 |
^((0@0) max: (firstPoint min: currentPoint)) extent: (firstPoint - currentPoint) abs |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
732 |
|
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
733 |
"Created: / 21.8.1998 / 20:17:07 / cg" |
1693 | 734 |
"Modified: / 10.2.2000 / 21:46:05 / cg" |
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
735 |
! |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
736 |
|
1245 | 737 |
drawCursorAt:aPoint |
738 |
|clr imgPoint| |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
739 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
740 |
image isNil ifTrue: [ |
1245 | 741 |
self updateImageInfo: self imageInfoString. |
742 |
self cursor:Cursor stop. |
|
743 |
^ self |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
744 |
]. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
745 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
746 |
(aPoint x < (image width * magnification) |
1060 | 747 |
and:[aPoint y < (image height * magnification) |
748 |
and:[aPoint x >= 0 |
|
749 |
and:[aPoint y >= 0]]]) |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
750 |
ifFalse:[ |
1245 | 751 |
self updateImageInfo: self imageInfoString. |
752 |
self cursor:Cursor stop. |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
753 |
] ifTrue: [ |
1245 | 754 |
imgPoint := aPoint // magnification. |
755 |
clr := image colorAt:imgPoint. |
|
756 |
self updateImageInfo: imgPoint printString |
|
757 |
, ' (r:' |
|
758 |
, clr redByte printString |
|
759 |
, ' g:' , clr greenByte printString |
|
760 |
, ' b:' , clr blueByte printString |
|
761 |
, ' pixel:' , (image pixelAt:imgPoint) printString |
|
762 |
, ')'. |
|
763 |
self cursor:Cursor crossHair |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
764 |
]. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
765 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
766 |
"Modified: / 29.7.1998 / 18:26:01 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
767 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
768 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
769 |
drawCursorAt: aPoint withLabel: aLabel |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
770 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
771 |
((0@0 extent: image extent * magnification) containsPoint: aPoint) |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
772 |
ifFalse:[self cursor:Cursor stop] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
773 |
ifTrue: [self cursor:Cursor crossHair]. |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
774 |
self updateImageInfo: aLabel. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
775 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
776 |
"Modified: / 29.7.1998 / 18:26:04 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
777 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
778 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
779 |
updateActivity: something |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
780 |
|msg| |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
781 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
782 |
msg := something printString. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
783 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
784 |
"/ cg: new code: |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
785 |
activityInfoHolder notNil ifTrue:[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
786 |
activityInfoHolder value:msg. |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
787 |
]. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
788 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
789 |
"Modified: / 29.7.1998 / 18:41:47 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
790 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
791 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
792 |
updateImageInfo: something |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
793 |
|msg coordLabel| |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
794 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
795 |
msg := something printString. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
796 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
797 |
"/ cg: new code: |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
798 |
imageInfoHolder notNil ifTrue:[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
799 |
msg ~= imageInfoHolder value ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
800 |
imageInfoHolder value:msg. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
801 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
802 |
^ self |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
803 |
]. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
804 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
805 |
"/ "/ cg: what a kludge - please change to use a valueHolder, |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
806 |
"/ "/ which gets the coordinate ... |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
807 |
"/ |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
808 |
"/ (masterApplication respondsTo: #coordLabel) |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
809 |
"/ ifTrue:[ |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
810 |
"/ coordLabel := masterApplication coordLabel. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
811 |
"/ |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
812 |
"/ coordLabel label ~= msg |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
813 |
"/ ifTrue:[ |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
814 |
"/ coordLabel label: msg. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
815 |
"/ "/ coordLabel redraw |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
816 |
"/ ] |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
817 |
"/ ] |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
818 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
819 |
"Modified: / 29.7.1998 / 19:00:21 / cg" |
627 | 820 |
! ! |
821 |
||
636 | 822 |
!ImageEditView methodsFor:'image editing'! |
627 | 823 |
|
824 |
boxAt: aPoint |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
825 |
"draw a rectangular outline with the currently selected color" |
627 | 826 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
827 |
|choosedBox imageBox clr| |
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
828 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
829 |
(clr := self selectedColor) notNil ifTrue:[ |
1693 | 830 |
choosedBox := self dragRectangleStartingAt: aPoint emphasis: #box. |
831 |
imageBox := choosedBox origin//magnification extent: (choosedBox extent//magnification). |
|
832 |
image rectangle:imageBox withColor:clr. |
|
833 |
image restored. |
|
834 |
self redraw: (choosedBox expandedBy: 1). |
|
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
835 |
|
1693 | 836 |
"/ "/ cg: what a kludge - please change to use a valueHolder, |
837 |
"/ "/ which gets the information ... |
|
838 |
"/ masterApplication imagePreView redraw: (imageBox expandedBy: 1). |
|
839 |
||
840 |
"/ cg: still a kludge - but less ugly |
|
841 |
self changed:#subImageIn with:(imageBox expandedBy: 1). |
|
842 |
||
843 |
modified := true |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
844 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
845 |
|
1693 | 846 |
"Modified: / 10.2.2000 / 23:42:08 / cg" |
632 | 847 |
! |
848 |
||
849 |
copyAt: aPoint |
|
850 |
||
1449 | 851 |
|choosenBox r| |
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
852 |
|
1449 | 853 |
choosenBox := self dragRectangleStartingAt: aPoint emphasis: #inverseFilledBox. |
995 | 854 |
ClipboardMagnification := nil. |
1449 | 855 |
Clipboard := image subImageIn: (choosenBox origin//magnification extent: (choosenBox extent//magnification)). |
856 |
r := (choosenBox expandedBy:1). |
|
857 |
self redraw:r |
|
632 | 858 |
|
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
859 |
"Modified: / 21.8.1998 / 20:16:41 / cg" |
632 | 860 |
! |
861 |
||
1228 | 862 |
cropLeft:doLeft right:doRight top:doTop bottom:doBottom |
1121 | 863 |
|yMinNew yMaxNew xMinNew xMaxNew |
864 |
pix stillCrobbing xMax yMax x y| |
|
865 |
||
866 |
xMax := image width - 1. |
|
867 |
yMax := image height - 1. |
|
868 |
||
869 |
xMinNew := 0. |
|
870 |
doLeft ifTrue:[ |
|
871 |
pix := image pixelAtX:xMinNew y:0. |
|
872 |
stillCrobbing := true. |
|
873 |
[stillCrobbing] whileTrue:[ |
|
874 |
0 to:yMax do:[:y | |
|
875 |
(image pixelAtX:xMinNew y:y) ~~ pix ifTrue:[ |
|
876 |
stillCrobbing := false |
|
877 |
] |
|
878 |
]. |
|
879 |
stillCrobbing ifTrue:[ |
|
880 |
xMinNew := xMinNew + 1. |
|
881 |
xMinNew >= image width ifTrue:[ |
|
882 |
self warn:'Image is all the same color - no crob.'. |
|
883 |
^ self |
|
884 |
] |
|
885 |
]. |
|
886 |
]. |
|
887 |
]. |
|
888 |
||
889 |
xMaxNew := xMax. |
|
890 |
doRight ifTrue:[ |
|
891 |
stillCrobbing := true. |
|
892 |
pix := image pixelAtX:xMaxNew y:0. |
|
893 |
[stillCrobbing] whileTrue:[ |
|
894 |
0 to:yMax do:[:y | |
|
895 |
(image pixelAtX:xMaxNew y:y) ~~ pix ifTrue:[ |
|
896 |
stillCrobbing := false |
|
897 |
] |
|
898 |
]. |
|
899 |
stillCrobbing ifTrue:[ |
|
900 |
xMaxNew := xMaxNew - 1. |
|
901 |
]. |
|
902 |
]. |
|
903 |
]. |
|
904 |
||
905 |
yMinNew := 0. |
|
906 |
doTop ifTrue:[ |
|
907 |
pix := image pixelAtX:xMinNew y:yMinNew. |
|
908 |
stillCrobbing := true. |
|
909 |
[stillCrobbing] whileTrue:[ |
|
910 |
xMinNew to:xMaxNew do:[:x | |
|
911 |
(image pixelAtX:x y:yMinNew) ~~ pix ifTrue:[ |
|
912 |
stillCrobbing := false |
|
913 |
] |
|
914 |
]. |
|
915 |
stillCrobbing ifTrue:[ |
|
916 |
yMinNew := yMinNew + 1. |
|
917 |
]. |
|
918 |
]. |
|
919 |
]. |
|
920 |
||
921 |
yMaxNew := yMax. |
|
922 |
doRight ifTrue:[ |
|
923 |
stillCrobbing := true. |
|
924 |
pix := image pixelAtX:xMaxNew y:yMaxNew. |
|
925 |
[stillCrobbing] whileTrue:[ |
|
926 |
xMinNew to:xMaxNew do:[:x | |
|
927 |
(image pixelAtX:x y:yMaxNew) ~~ pix ifTrue:[ |
|
928 |
stillCrobbing := false |
|
929 |
] |
|
930 |
]. |
|
931 |
stillCrobbing ifTrue:[ |
|
932 |
yMaxNew := yMaxNew - 1. |
|
933 |
]. |
|
934 |
]. |
|
935 |
]. |
|
936 |
||
937 |
(xMinNew == 0 |
|
938 |
and:[xMaxNew == (image width - 1) |
|
939 |
and:[yMinNew == 0 |
|
940 |
and:[yMaxNew == (image height - 1)]]]) ifTrue:[ |
|
941 |
self warn:'No border found - no crob.'. |
|
942 |
^ self |
|
943 |
]. |
|
944 |
||
945 |
"/ self warn:'extract subImage ' |
|
946 |
"/ , (xMinNew @ yMinNew) printString |
|
947 |
"/ , ' -> ' |
|
948 |
"/ , (xMaxNew @ yMaxNew) printString. |
|
949 |
||
950 |
self |
|
951 |
makeSubImageX:xMinNew y:yMinNew |
|
952 |
width:(xMaxNew - xMinNew + 1) |
|
953 |
height:(yMaxNew - yMinNew + 1) |
|
954 |
||
955 |
"Created: / 7.9.1998 / 14:25:52 / cg" |
|
956 |
"Modified: / 7.9.1998 / 16:35:35 / cg" |
|
957 |
! |
|
958 |
||
632 | 959 |
fillAt: aPoint |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
960 |
"perform a flood-fill with the currently selected color" |
627 | 961 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
962 |
windowGroup withExecuteCursorDo:[ |
1693 | 963 |
|filledPoints clr| |
1002 | 964 |
|
1693 | 965 |
(clr := self selectedColor) notNil ifTrue:[ |
966 |
self updateActivity:'Flood filling - press CTRL-y to abort ...'. |
|
967 |
[ |
|
968 |
filledPoints := image floodFillAt: aPoint//magnification withColor:clr. |
|
969 |
image restored. |
|
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
970 |
|
1693 | 971 |
"/ animation effect ... |
972 |
filledPoints size < 300 ifTrue: [ |
|
973 |
filledPoints do: [:p| self redraw: ((p * magnification extent: magnification) expandedBy: 1)] |
|
974 |
] ifFalse: [ |
|
975 |
self invalidate |
|
976 |
]. |
|
977 |
||
978 |
"/ "/ cg: what a kludge - please change to use a valueHolder, |
|
979 |
"/ "/ which gets the information ... |
|
980 |
"/ masterApplication imagePreView invalidate. |
|
981 |
||
982 |
"/ cg: still a kludge - but less ugly |
|
983 |
self changed:#subImageIn with:(image bounds). |
|
984 |
||
985 |
modified := true |
|
986 |
] valueOnUnwindDo:[ |
|
987 |
self updateActivity:'Flood fill aborted.' |
|
988 |
]. |
|
989 |
]. |
|
990 |
self updateActivity:'' |
|
632 | 991 |
] |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
992 |
|
1693 | 993 |
"Modified: / 10.2.2000 / 23:40:58 / cg" |
632 | 994 |
! |
995 |
||
996 |
filledBoxAt: aPoint |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
997 |
"fill a rectangular area with the currently selected color" |
632 | 998 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
999 |
|choosedBox imageBox clr| |
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
1000 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1001 |
(clr := self selectedColor) notNil ifTrue:[ |
1693 | 1002 |
choosedBox := self dragRectangleStartingAt: aPoint emphasis: #filledBox. |
1003 |
imageBox := choosedBox origin//magnification extent: (choosedBox extent//magnification). |
|
1004 |
image fillRectangle:imageBox withColor:clr. |
|
1005 |
image restored. |
|
1006 |
self redraw: (choosedBox expandedBy: 1). |
|
1007 |
||
1008 |
"/ "/ cg: what a kludge - please change to use a valueHolder, |
|
1009 |
"/ "/ which gets the information ... |
|
1010 |
"/ masterApplication imagePreView redraw: (imageBox expandedBy: 1). |
|
1011 |
||
1012 |
"/ cg: still a kludge - but less ugly |
|
1013 |
self changed:#subImageIn with:(imageBox expandedBy: 1). |
|
1014 |
||
1015 |
modified := true |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1016 |
] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1017 |
|
1693 | 1018 |
"Modified: / 10.2.2000 / 23:37:04 / cg" |
632 | 1019 |
! |
1020 |
||
636 | 1021 |
flipHorizontal |
1022 |
||
995 | 1023 |
self makeUndo. |
725 | 1024 |
self image: image copy flipHorizontal |
636 | 1025 |
|
1026 |
! |
|
1027 |
||
1028 |
flipVertical |
|
1029 |
||
995 | 1030 |
self makeUndo. |
725 | 1031 |
self image: image copy flipVertical |
636 | 1032 |
|
1033 |
! |
|
1034 |
||
1706 | 1035 |
magnifyImageTo:newSize |
1036 |
self makeUndo. |
|
1037 |
self image: (image magnifiedBy: newSize/image extent) |
|
636 | 1038 |
! |
1039 |
||
1886 | 1040 |
makeGrayScale |
1041 |
|xMax yMax r g b n_r n_g n_b clr pix map revMap n_clr n_pix anyChange |
|
1042 |
newColors newColorArray newImage| |
|
1043 |
||
1044 |
anyChange := false. |
|
1045 |
||
1046 |
xMax := image width - 1. |
|
1047 |
yMax := image height - 1. |
|
1048 |
||
1049 |
newColors := Set new. |
|
1050 |
newColorArray := OrderedCollection new. |
|
1903 | 1051 |
map := Array new:256. |
1886 | 1052 |
revMap := OrderedCollection new. |
1053 |
||
1054 |
newImage := image class width:image width height:image height depth:image depth. |
|
1055 |
newImage photometric:image photometric. |
|
1056 |
newImage colorMap:(image colorMap copy). |
|
1057 |
newImage bits:(ByteArray new:(image bits size)). |
|
1058 |
newImage mask:(image mask copy). |
|
1059 |
||
1060 |
0 to:yMax do:[:y | |
|
1061 |
0 to:xMax do:[:x | |
|
1062 |
pix := image pixelAtX:x y:y. |
|
1063 |
(n_pix := map at:pix+1) isNil ifTrue:[ |
|
1064 |
clr := image colorAtX:x y:y. |
|
1065 |
n_clr := Color brightness:(clr brightness). |
|
1066 |
(newColors includes:n_clr) ifFalse:[ |
|
1067 |
newColors add:n_clr. |
|
1068 |
newColorArray add:n_clr. |
|
1069 |
revMap add:pix. |
|
1070 |
map at:pix+1 put:(n_pix := revMap size - 1). |
|
1071 |
] ifTrue:[ |
|
1072 |
"/ mhmh - multiple pixels mapped to the same color |
|
1073 |
n_pix := (newColorArray indexOf:n_clr) - 1. |
|
1074 |
map at:pix+1 put:n_pix. |
|
1075 |
] |
|
1076 |
]. |
|
1077 |
newImage pixelAtX:x y:y put:n_pix. |
|
1078 |
] |
|
1079 |
]. |
|
1080 |
||
1081 |
newImage colorMap:(Colormap fromColors:newColorArray). |
|
1082 |
self makeUndo. |
|
1083 |
self image:newImage. |
|
1084 |
^ true |
|
1085 |
! |
|
1086 |
||
1121 | 1087 |
makeSubImageX:oldX y:oldY width:newWidth height:newHeight |
1088 |
|newImage| |
|
1089 |
||
1090 |
newImage := image class width:newWidth height:newHeight depth:image depth. |
|
1091 |
newImage photometric:image photometric. |
|
1092 |
newImage colorMap:image colorMap copy. |
|
1093 |
newImage bits:(ByteArray new:(newImage bytesPerRow * newHeight)). |
|
1094 |
||
1095 |
image mask notNil |
|
1096 |
ifTrue:[ |
|
1097 |
|newMaskImage| |
|
1098 |
||
1099 |
newMaskImage := Depth1Image width:newWidth height:newHeight. |
|
1100 |
newMaskImage photometric: image mask photometric. |
|
1101 |
newMaskImage colorMap: image mask colorMap copy. |
|
1102 |
newMaskImage bits:(ByteArray new: newMaskImage bytesPerRow * newHeight). |
|
1103 |
newImage mask: newMaskImage |
|
1104 |
]. |
|
1105 |
||
1106 |
newImage copyFrom:image x:oldX y:oldY toX:0 y:0 width:newWidth height:newHeight. |
|
1107 |
self makeUndo. |
|
1886 | 1108 |
self image:newImage. |
1121 | 1109 |
|
1110 |
"Created: / 7.9.1998 / 13:00:16 / cg" |
|
1111 |
"Modified: / 7.9.1998 / 14:15:32 / cg" |
|
1112 |
! |
|
1113 |
||
636 | 1114 |
negativeImage |
1115 |
||
995 | 1116 |
self makeUndo. |
1411 | 1117 |
self image: (image copy bits:(image bits invert)) |
636 | 1118 |
! |
1119 |
||
1120 |
pasteAt: aPoint |
|
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1121 |
"paste the image in the clipboard at aPoint" |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1122 |
|
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1123 |
self pasteAt:aPoint modeUnder:false. |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1124 |
! |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1125 |
|
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1126 |
pasteAt: aPoint modeUnder:modeUnder |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1127 |
"paste the image in the clipboard at aPoint" |
636 | 1128 |
|
1888 | 1129 |
|answer| |
1130 |
||
1131 |
ClipboardMagnification isNil ifTrue: [ |
|
1132 |
"/ ^self |
|
1133 |
]. |
|
995 | 1134 |
|
636 | 1135 |
Object errorSignal handle: |
1136 |
[:ex| |
|
1246 | 1137 |
ex signal == Image unrepresentableColorSignal ifFalse:[ |
1138 |
ex reject |
|
1139 |
]. |
|
1140 |
self undo. |
|
1141 |
self warn: 'Paste failed !!\Increasing the images depth might help.' withCRs. |
|
1823 | 1142 |
] do: [ |
1246 | 1143 |
windowGroup withExecuteCursorDo:[ |
1888 | 1144 |
|anyColorMissing choosedBox imagePoint imgX imgY copiedImage imageBox presentClr newColorMap| |
995 | 1145 |
|
1246 | 1146 |
choosedBox := self dragRectangleStartingAt: aPoint emphasis: #inverseFilledBox. |
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1147 |
|
1246 | 1148 |
imagePoint := choosedBox origin//magnification. |
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1149 |
|
1246 | 1150 |
copiedImage := Clipboard copy. |
1888 | 1151 |
true |
1152 |
"/ image photometric == #palette |
|
1153 |
ifTrue:[ |
|
1246 | 1154 |
"/ for all colors in the pasted image, |
1155 |
"/ check, if its in the colormap of the |
|
1156 |
"/ target image. |
|
995 | 1157 |
|
1888 | 1158 |
anyColorMissing := false. |
1246 | 1159 |
copiedImage usedValues do:[:pixel | |
1160 |
|pastedColor oldColorMap| |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1161 |
|
1246 | 1162 |
pastedColor := copiedImage colorFromValue:pixel. |
1163 |
oldColorMap := image colorMap. |
|
1028
4dfe1c6cbc48
fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1164 |
|
1246 | 1165 |
(oldColorMap detect: [:clr| clr = pastedColor] ifNone: nil) isNil |
1166 |
ifTrue: |
|
1167 |
[ |
|
1168 |
oldColorMap size < (1 bitShift:image depth) ifTrue:[ |
|
1169 |
"/ add to colormap |
|
1170 |
newColorMap isNil ifTrue:[ |
|
1171 |
newColorMap := oldColorMap asOrderedCollection. |
|
1172 |
]. |
|
1173 |
newColorMap add:pastedColor. |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1174 |
"/ Transcript showCR:'adding color:' , pastedColor displayString , ' to targets colorMap'. |
1246 | 1175 |
] ifFalse:[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1176 |
"/ Transcript showCR:'color:' , pastedColor displayString , ' not found in targets colorMap'. |
1888 | 1177 |
copiedImage colorMap notNil ifTrue:[ |
1178 |
copiedImage colorMap at: pixel+1 put: Color black. |
|
1179 |
]. |
|
1180 |
anyColorMissing := true. |
|
1246 | 1181 |
] |
1182 |
] |
|
1183 |
]. |
|
1888 | 1184 |
anyColorMissing ifTrue:[ |
1185 |
answer := Dialog |
|
1186 |
confirmWithCancel:'Some color(s) cannot be represented (colorMap full). Use nearest or compute colorMap ?' |
|
1187 |
labels:#('use nearest' 'new ColorMap' 'cancel') |
|
1188 |
values:#(nearest new nil) |
|
1189 |
default:1. |
|
1190 |
||
1191 |
answer isNil ifTrue:[^ self]. |
|
1192 |
answer == #nearest ifTrue:[ |
|
1193 |
0 to:copiedImage height-1 do:[:y | |
|
1194 |
0 to:copiedImage width-1 do:[:x | |
|
1195 |
|clr n_clr| |
|
1196 |
||
1197 |
clr := copiedImage atX:x y:y. |
|
1198 |
n_clr := clr nearestIn:image colorMap. |
|
1199 |
copiedImage atX:x y:y put:n_clr |
|
1200 |
] |
|
1201 |
]. |
|
1202 |
] ifFalse:[ |
|
1203 |
self warn:'Sorry: unimplemented function'. |
|
1204 |
self undo. |
|
1205 |
^ self. |
|
1206 |
]. |
|
1207 |
]. |
|
995 | 1208 |
|
1246 | 1209 |
newColorMap notNil ifTrue:[ |
1210 |
image colorMap:(Colormap fromColors:newColorMap). |
|
1211 |
]. |
|
1212 |
]. |
|
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1213 |
|
1246 | 1214 |
copiedImage := image class fromImage: copiedImage. |
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1215 |
(newColorMap isNil |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1216 |
and:[modeUnder not |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1217 |
and:[copiedImage mask isNil]]) ifTrue:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1218 |
"/ use images copy functionality |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1219 |
"/ however, this copies the mask as well, |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1220 |
"/ which is not useful here |
1246 | 1221 |
image copyFrom: copiedImage x:0 y:0 toX: imagePoint x y: imagePoint y width: copiedImage width height: copiedImage height. |
1222 |
] ifFalse:[ |
|
994
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
1223 |
|
1246 | 1224 |
imgX := imagePoint x. |
1225 |
imgY := imagePoint y. |
|
1028
4dfe1c6cbc48
fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1226 |
|
1246 | 1227 |
0 to:copiedImage height-1 do:[:y | |
1228 |
0 to:copiedImage width-1 do:[:x | |
|
1229 |
|wasMasked newMasked dstX dstY oldColor| |
|
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1230 |
|
1246 | 1231 |
dstX := imgX + x. |
1232 |
dstY := imgY + y. |
|
1233 |
wasMasked := (image maskAtX:dstX y:dstY) == 0. |
|
1234 |
newMasked := (copiedImage maskAtX:x y:y) == 0. |
|
994
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
1235 |
|
1246 | 1236 |
"/ with modeUnder, |
1237 |
"/ only replace, if its either unmasked, |
|
1238 |
"/ or the current drawing color. |
|
1239 |
(modeUnder not |
|
1240 |
or:[wasMasked |
|
1241 |
or:[(oldColor := image colorAtX:dstX y:dstY) = (drawingColors at:1)]]) |
|
1242 |
ifTrue:[ |
|
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1243 |
newMasked ifFalse:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1244 |
image |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1245 |
colorAtX:dstX |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1246 |
y:dstY |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1247 |
put:(copiedImage colorAtX:x y:y). |
1823 | 1248 |
wasMasked ifTrue:[ |
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1249 |
image mask pixelAtX:dstX y:dstY put:1 |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1250 |
]. |
1823 | 1251 |
] ifTrue:[ |
1252 |
wasMasked ifFalse:[ |
|
1253 |
image mask pixelAtX:dstX y:dstY put:0 |
|
1254 |
] |
|
1255 |
]. |
|
1246 | 1256 |
] |
1257 |
] |
|
1258 |
]. |
|
1259 |
]. |
|
1260 |
image restored. |
|
1261 |
self redraw: (imageBox := (imagePoint * magnification extent: (Clipboard extent * magnification)) expandedBy: 1@1). |
|
1028
4dfe1c6cbc48
fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1262 |
"/ masterApplication imagePreView redraw: (imageBox expandedBy: 1). |
1246 | 1263 |
modified := true |
1264 |
] |
|
1028
4dfe1c6cbc48
fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1265 |
] |
4dfe1c6cbc48
fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1266 |
|
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1267 |
"Modified: / 18.5.1999 / 20:40:37 / cg" |
636 | 1268 |
! |
1269 |
||
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1270 |
pasteUnderAt: aPoint |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1271 |
"pasteUnder the image in the clipboard at aPoint. |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1272 |
In this mode, only pixels which are not equal to |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1273 |
the current color or masked are pasted." |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1274 |
|
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1275 |
self pasteAt:aPoint modeUnder:true. |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1276 |
! |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1277 |
|
1858 | 1278 |
performSpecialOperationOn:imageBox withColor:clr |
1279 |
|operation x0 y0 x1 y1 grey| |
|
1280 |
||
1281 |
operation := Dialog |
|
1282 |
choose:'Which Operation:' |
|
1283 |
fromList:#( |
|
1284 |
"/ 'brighten' |
|
1285 |
"/ 'darken' |
|
1286 |
"/ '-' |
|
1287 |
"/ 'greying' |
|
1288 |
'grey pattern' |
|
1289 |
) |
|
1859 | 1290 |
values:#("brighten darken nil greying "greyPattern) |
1858 | 1291 |
lines:6 |
1292 |
cancel:nil. |
|
1293 |
||
1294 |
self invalidate. |
|
1295 |
self windowGroup processExposeEvents. |
|
1296 |
||
1297 |
operation isNil ifTrue:[^ false]. |
|
1298 |
||
1299 |
x0 := imageBox left. |
|
1300 |
y0 := imageBox top. |
|
1861 | 1301 |
x1 := imageBox right - 1. |
1302 |
y1 := imageBox bottom -1 . |
|
1858 | 1303 |
|
1304 |
operation == #brighten ifTrue:[ |
|
1305 |
self image colorsFromX:x0 y:y0 toX:x1 y:y1 do:[:x :y :clr | |
|
1306 |
self image colorAtX:x y:y put:(clr lightened). |
|
1307 |
]. |
|
1308 |
^ true. |
|
1309 |
]. |
|
1310 |
operation == #darken ifTrue:[ |
|
1311 |
self image colorsFromX:x0 y:y0 toX:x1 y:y1 do:[:x :y :clr | |
|
1312 |
self image colorAtX:x y:y put:(clr darkened). |
|
1313 |
]. |
|
1314 |
^ true. |
|
1315 |
]. |
|
1316 |
operation == #greying ifTrue:[ |
|
1317 |
self image colorsFromX:x0 y:y0 toX:x1 y:y1 do:[:x :y :clr | |
|
1318 |
self image colorAtX:x y:y put:(clr blendWith:Color grey). |
|
1319 |
]. |
|
1320 |
^ true. |
|
1321 |
]. |
|
1322 |
operation == #greyPattern ifTrue:[ |
|
1323 |
grey := Color grey nearestIn:(self image colorMap). |
|
1324 |
self image colorsFromX:x0 y:y0 toX:x1 y:y1 do:[:x :y :clr | |
|
1325 |
(x + y )odd ifTrue:[ |
|
1326 |
self image colorAtX:x y:y put:grey. |
|
1327 |
] |
|
1328 |
]. |
|
1329 |
^ true. |
|
1330 |
]. |
|
1331 |
||
1332 |
self halt. |
|
1333 |
^ false. |
|
1334 |
! |
|
1335 |
||
636 | 1336 |
pointAt: aPoint |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1337 |
"draw a single pixel with the currently selected color" |
636 | 1338 |
|
1246 | 1339 |
|imagePoint clr pix| |
796 | 1340 |
|
1246 | 1341 |
imagePoint := aPoint // magnification. |
1277 | 1342 |
(clr := self selectedColor) isNil ifTrue:[ |
1343 |
pix := self selectedColorIndex |
|
1246 | 1344 |
]. |
1345 |
pix notNil ifTrue:[ |
|
1277 | 1346 |
image colorMap atImageAndMask:imagePoint putValue:pix. |
1245 | 1347 |
modified := true. |
1277 | 1348 |
] ifFalse:[ |
1349 |
clr notNil ifTrue:[ |
|
1350 |
image atImageAndMask:imagePoint put:clr. |
|
1351 |
modified := true. |
|
1352 |
]. |
|
1246 | 1353 |
]. |
1277 | 1354 |
self invalidate:((imagePoint * magnification extent: magnification) expandedBy: 1). |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1355 |
|
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1356 |
"Modified: / 5.9.1998 / 13:25:29 / cg" |
636 | 1357 |
! |
1358 |
||
1374 | 1359 |
reduceColorResolutionBy:numBits |
1885
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1360 |
|xMax yMax r g b n_r n_g n_b clr pix map revMap n_clr n_pix mask anyChange |
1886 | 1361 |
newColors newColorArray newImage| |
1374 | 1362 |
|
1363 |
anyChange := false. |
|
1364 |
||
1365 |
xMax := image width - 1. |
|
1366 |
yMax := image height - 1. |
|
1885
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1367 |
mask := (16rFF bitShift:numBits) bitAnd:16rFF. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1368 |
|
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1369 |
newColors := Set new. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1370 |
newColorArray := OrderedCollection new. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1371 |
map := Array new:255. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1372 |
revMap := OrderedCollection new. |
1374 | 1373 |
|
1886 | 1374 |
newImage := image class width:image width height:image height depth:image depth. |
1375 |
newImage photometric:image photometric. |
|
1376 |
newImage colorMap:(image colorMap copy). |
|
1377 |
newImage bits:(ByteArray new:(image bits size)). |
|
1378 |
newImage mask:(image mask copy). |
|
1379 |
||
1374 | 1380 |
0 to:yMax do:[:y | |
1381 |
0 to:xMax do:[:x | |
|
1885
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1382 |
pix := image pixelAtX:x y:y. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1383 |
(n_pix := map at:pix+1) isNil ifTrue:[ |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1384 |
clr := image colorAtX:x y:y. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1385 |
n_r := (r := clr redByte) bitAnd:mask. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1386 |
n_g := (g := clr greenByte) bitAnd:mask. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1387 |
n_b := (b := clr blueByte) bitAnd:mask. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1388 |
n_clr := Color redByte:n_r greenByte:n_g blueByte:n_b. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1389 |
(newColors includes:n_clr) ifFalse:[ |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1390 |
newColors add:n_clr. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1391 |
newColorArray add:n_clr. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1392 |
revMap add:pix. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1393 |
map at:pix+1 put:(n_pix := revMap size - 1). |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1394 |
] ifTrue:[ |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1395 |
"/ mhmh - multiple pixels mapped to the same color |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1396 |
n_pix := (newColorArray indexOf:n_clr) - 1. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1397 |
map at:pix+1 put:n_pix. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1398 |
] |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1399 |
]. |
1886 | 1400 |
newImage pixelAtX:x y:y put:n_pix. |
1374 | 1401 |
] |
1402 |
]. |
|
1885
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1403 |
revMap size == image colorMap size ifTrue:[ |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1404 |
revMap = (0 to:revMap size-1) ifTrue:[ |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1405 |
^ false |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1406 |
] |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1407 |
]. |
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1408 |
|
1886 | 1409 |
newImage colorMap:(Colormap fromColors:newColorArray). |
1410 |
self makeUndo. |
|
1411 |
self image:newImage. |
|
1885
5f85501aaea9
reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents:
1882
diff
changeset
|
1412 |
^ true |
1374 | 1413 |
! |
1414 |
||
1706 | 1415 |
resizeImageTo:newSize |
1416 |
||
1417 |
|newImage newMaskImage| |
|
1418 |
||
1419 |
newImage := image class width: newSize x height: newSize y depth: image depth. |
|
1420 |
newImage photometric:image photometric. |
|
1421 |
newImage colorMap:image colorMap copy. |
|
1422 |
newImage bits: (ByteArray new: newImage bytesPerRow * newSize y). |
|
636 | 1423 |
|
1706 | 1424 |
image mask notNil ifTrue:[ |
1425 |
newMaskImage := Depth1Image width: newSize x height: newSize y. |
|
1426 |
newMaskImage photometric: image mask photometric. |
|
1427 |
newMaskImage colorMap: image mask colorMap copy. |
|
1428 |
newMaskImage bits:(ByteArray new: newMaskImage bytesPerRow * newSize y). |
|
1429 |
newImage mask: newMaskImage |
|
1430 |
]. |
|
636 | 1431 |
|
1706 | 1432 |
newImage copyFrom:image x:0 y:0 toX:0 y:0 width: (image width min:newSize x) height: (image height min:newSize y). |
1433 |
self makeUndo. |
|
1434 |
self image: newImage. |
|
636 | 1435 |
! |
1436 |
||
1706 | 1437 |
rotateImageBy:rotation |
1438 |
"rotate by (degrees)" |
|
636 | 1439 |
|
1706 | 1440 |
Object errorSignal handle:[:ex| |
1441 |
self warn: 'Image rotation failed!!\' withCRs, 'Increaing the image depth could help.' |
|
1442 |
] do:[ |
|
1443 |
self makeUndo. |
|
1444 |
self image: (image hardRotated: rotation) |
|
686 | 1445 |
] |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1446 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1447 |
"Modified: / 29.7.1998 / 18:21:14 / cg" |
636 | 1448 |
! |
1449 |
||
1858 | 1450 |
specialOperationAt: aPoint |
1451 |
"special operation on a rectangular area" |
|
1452 |
||
1453 |
|choosedBox imageBox clr| |
|
1454 |
||
1455 |
choosedBox := self dragRectangleStartingAt: aPoint emphasis: #filledBox. |
|
1456 |
imageBox := choosedBox origin//magnification extent: (choosedBox extent//magnification). |
|
1457 |
||
1458 |
(self performSpecialOperationOn:imageBox withColor:self selectedColor) ifFalse:[ |
|
1459 |
^ self |
|
1460 |
]. |
|
1461 |
||
1462 |
image restored. |
|
1861 | 1463 |
self invalidate. "/ : (choosedBox expandedBy: 1). |
1464 |
||
1465 |
"/ self redraw: (choosedBox expandedBy: 1). |
|
1858 | 1466 |
|
1467 |
"/ "/ cg: what a kludge - please change to use a valueHolder, |
|
1468 |
"/ "/ which gets the information ... |
|
1469 |
"/ masterApplication imagePreView redraw: (imageBox expandedBy: 1). |
|
1470 |
||
1471 |
"/ cg: still a kludge - but less ugly |
|
1472 |
self changed:#subImageIn with:(imageBox expandedBy: 1). |
|
1473 |
||
1474 |
modified := true |
|
1475 |
! |
|
1476 |
||
636 | 1477 |
undo |
1478 |
||
1693 | 1479 |
undoImages notEmpty ifTrue:[ |
1374 | 1480 |
windowGroup withExecuteCursorDo:[ |
1481 |
modified := false. |
|
1482 |
self image: undoImages removeLast. |
|
1693 | 1483 |
"/ "/ cg: what a kludge - please change to use a valueHolder, |
1484 |
"/ masterApplication notNil ifTrue:[ |
|
1485 |
"/ masterApplication listOfColors contents: image colorMap. |
|
1486 |
"/ masterApplication findColorMapMode. |
|
1487 |
"/"/ undoImages isEmpty ifTrue: [ |
|
1488 |
"/"/ masterApplication valueOfCanUndo value: false |
|
1489 |
"/"/ ]. |
|
1490 |
"/ ]. |
|
1491 |
self changed:#image. |
|
1492 |
||
1374 | 1493 |
"/ cg: not needed - image: already does it. |
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
1494 |
"/ self invalidate |
1374 | 1495 |
] |
636 | 1496 |
] |
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
1497 |
|
1693 | 1498 |
"Modified: / 10.2.2000 / 23:21:24 / cg" |
627 | 1499 |
! ! |
1500 |
||
1501 |
!ImageEditView methodsFor:'image setting'! |
|
1502 |
||
1503 |
image:anImage |
|
1256 | 1504 |
|retVal fileName| |
627 | 1505 |
|
1256 | 1506 |
anImage isImage ifTrue:[ |
1507 |
(image isNil or: [self checkModified]) ifTrue: [ |
|
1693 | 1508 |
"/ cg: that is too ugly ... |
1509 |
"/ masterApplication notNil ifTrue: [ |
|
1510 |
"/"/ undoImages notEmpty ifTrue: [ |
|
1511 |
"/"/ masterApplication valueOfCanUndo value: true |
|
1512 |
"/"/ ]. |
|
1513 |
"/ masterApplication imagePreView image: anImage |
|
1514 |
"/ ]. |
|
1256 | 1515 |
image notNil ifTrue: [ |
1516 |
fileName := image fileName. |
|
1517 |
anImage fileName isNil ifTrue: [anImage fileName: fileName]. |
|
1518 |
]. |
|
1519 |
super image: anImage. |
|
1520 |
retVal := self. |
|
1521 |
]. |
|
1522 |
] ifFalse: [ |
|
1523 |
super image: nil. |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1524 |
]. |
1763
7d6d64622ee4
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1706
diff
changeset
|
1525 |
"/cg: still a kludge, but less ugly |
7d6d64622ee4
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1706
diff
changeset
|
1526 |
self changed:#image. |
1025
4470f3ad349f
update the image label, when a new image is assigned.
Claus Gittinger <cg@exept.de>
parents:
1019
diff
changeset
|
1527 |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1528 |
self updateImageInfo: self imageInfoString. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1529 |
^ retVal |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1530 |
|
1693 | 1531 |
"Modified: / 10.2.2000 / 23:33:12 / cg" |
627 | 1532 |
! |
1533 |
||
1534 |
loadFromFile: aFileName |
|
624 | 1535 |
|
676 | 1536 |
aFileName isNil ifTrue: [^nil]. |
1774 | 1537 |
|
1538 |
Object errorSignal handle:[:exeption| |
|
1539 |
modified := false. |
|
1540 |
self warn: exeption errorString. |
|
1541 |
^nil |
|
1542 |
] do:[ |
|
1543 |
|imageFromFile| |
|
1544 |
(imageFromFile := Image fromFile: aFileName) notNil |
|
1545 |
ifTrue:[ |
|
1546 |
self releaseUndos. |
|
1547 |
self image: imageFromFile. |
|
1548 |
imageReaderClass := ImageReader allSubclasses |
|
1865 | 1549 |
detect: [:cls| cls isValidImageFile: aFileName asFilename pathName] |
1774 | 1550 |
ifNone: [self error: 'Unknown image file format!!'] |
1551 |
] ifFalse:[ |
|
1552 |
self error: 'Not an image file (or unrecognized format) !!' |
|
1553 |
] |
|
676 | 1554 |
] |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1555 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1556 |
"Modified: / 29.7.1998 / 18:09:13 / cg" |
624 | 1557 |
! |
255 | 1558 |
|
633 | 1559 |
loadFromMessage: aMessage |
1560 |
||
1781 | 1561 |
(self resourceMessage: aMessage) isNil ifTrue:[ |
1562 |
^ nil |
|
633 | 1563 |
]. |
624 | 1564 |
|
633 | 1565 |
^self loadfromClass: resourceClass andSelector: resourceSelector |
1566 |
||
1567 |
||
1568 |
! |
|
1569 |
||
1570 |
loadfromClass: aClassOrSymbol andSelector: aStringOrSymbol |
|
1571 |
||
678 | 1572 |
|aClass| |
1573 |
||
627 | 1574 |
imageReaderClass := nil. |
1575 |
self resourceClass: aClassOrSymbol. |
|
1576 |
self resourceSelector: aStringOrSymbol. |
|
678 | 1577 |
|
1578 |
((aClass := Smalltalk at: resourceClass) isClass and: |
|
1579 |
[aClass class implements: resourceSelector]) |
|
624 | 1580 |
ifTrue: |
1581 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1582 |
self releaseUndos. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1583 |
^self image: (aClass perform: resourceSelector) copy |
674 | 1584 |
] |
1585 |
ifFalse: |
|
1586 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1587 |
modified := false. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1588 |
^nil |
674 | 1589 |
] |
1590 |
||
161 | 1591 |
! ! |
1592 |
||
1327 | 1593 |
!ImageEditView methodsFor:'initialize / release'! |
1594 |
||
1595 |
destroy |
|
1596 |
||
1597 |
ClipboardMagnification := Clipboard := nil. |
|
1598 |
LastMagnification := magnification. |
|
1599 |
||
1600 |
super destroy |
|
1601 |
||
1602 |
! |
|
1 | 1603 |
|
161 | 1604 |
initialize |
624 | 1605 |
|
161 | 1606 |
super initialize. |
627 | 1607 |
|
686 | 1608 |
self enableMotionEvents. |
995 | 1609 |
|
1374 | 1610 |
undoImages := List new: MaxUndos. |
1706 | 1611 |
magnification := LastMagnification ? (8@8). |
995 | 1612 |
modified := false. |
627 | 1613 |
mouseKeyColorMode := 1. |
995 | 1614 |
resourceClass := resourceSelector := ''. |
1246 | 1615 |
drawingColors := Array with: nil with: nil. "/ left/right mouse colors |
1616 |
drawingPixels := Array with: nil with: nil. "/ left/right mouse colors |
|
1106 | 1617 |
editMode := #point. |
1036 | 1618 |
|
1 | 1619 |
! ! |
1620 |
||
636 | 1621 |
!ImageEditView methodsFor:'printing & storing'! |
1 | 1622 |
|
724 | 1623 |
loadFromClass |
404 | 1624 |
|
676 | 1625 |
^self loadFromMessage: |
1184 | 1626 |
(ResourceSelectionBrowser |
1627 |
request: 'Load Image From Class' |
|
1628 |
onSuperclass: nil |
|
1629 |
andClass: self resourceClass |
|
1630 |
andSelector: self resourceSelector |
|
1631 |
withResourceTypes: #(image fileImage programImage)) |
|
636 | 1632 |
|
477 | 1633 |
|
161 | 1634 |
! |
1635 |
||
995 | 1636 |
makeUndo |
1637 |
||
1374 | 1638 |
image notNil ifTrue:[ |
1639 |
undoImages size >= MaxUndos ifTrue:[ |
|
1640 |
undoImages removeFirst. |
|
1641 |
]. |
|
1642 |
undoImages add: image copy |
|
995 | 1643 |
] |
1644 |
! |
|
1645 |
||
627 | 1646 |
|
624 | 1647 |
|
686 | 1648 |
image notNil |
1649 |
ifTrue: |
|
636 | 1650 |
[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1651 |
|stream| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1652 |
Printer supportsPostscript ifFalse: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1653 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1654 |
^self warn:'No postscript printer detected!!' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1655 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1656 |
stream := Printer newNative. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1657 |
stream isNil ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1658 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1659 |
^self warn:'Cannot open printer stream!!' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1660 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1661 |
self withWaitCursorDo: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1662 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1663 |
|psgc| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1664 |
psgc := PSGraphicsContext on:stream. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1665 |
psgc displayForm: (image magnifiedBy: magnification) x:0 y:0. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1666 |
psgc close |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1667 |
] |
398
7b7255a4db0d
show a wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1668 |
] |
624 | 1669 |
! |
1670 |
||
1671 |
save |
|
1672 |
||
632 | 1673 |
self saveImageOrMask: #image. |
1674 |
||
624 | 1675 |
! |
1676 |
||
297 | 1677 |
saveAs |
1678 |
||
627 | 1679 |
self saveImageFileAs |
297 | 1680 |
! |
1681 |
||
627 | 1682 |
saveImageFileAs |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1683 |
"ask for a fileName and save the image" |
627 | 1684 |
|
633 | 1685 |
self saveImageFileAs: |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1686 |
(FileSelectionBrowser |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1687 |
request: 'Save Image To File' |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1688 |
fileName: self image fileName |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1689 |
withFileFilters: FileSelectionBrowser saveImageFileNameFilters) |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1690 |
|
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1691 |
"Modified: / 30.9.1998 / 23:05:19 / cg" |
627 | 1692 |
! |
297 | 1693 |
|
627 | 1694 |
saveImageFileAs: aFileName |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1695 |
"save the image in aFileName" |
297 | 1696 |
|
633 | 1697 |
aFileName isNil ifTrue: [^nil]. |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1698 |
image notNil ifTrue:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1699 |
image fileName: aFileName. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1700 |
self saveImageOrMask: #image |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1701 |
] ifFalse:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1702 |
self warn: 'No image or file name for saving detected!!' |
632 | 1703 |
] |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1704 |
|
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1705 |
"Modified: / 30.9.1998 / 23:04:55 / cg" |
632 | 1706 |
! |
1707 |
||
1708 |
saveImageMaskFileAs |
|
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1709 |
"ask for a fileName and save the mask only" |
632 | 1710 |
|
633 | 1711 |
self saveImageMaskFileAs: |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1712 |
(FileSelectionBrowser |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1713 |
request: 'Save Image Mask To File' |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1714 |
fileName: self image fileName |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1715 |
withFileFilters: FileSelectionBrowser saveImageFileNameFilters) |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1716 |
|
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1717 |
"Modified: / 30.9.1998 / 23:04:11 / cg" |
632 | 1718 |
! |
1719 |
||
1720 |
saveImageMaskFileAs: aFileName |
|
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1721 |
"save the mask only in aFileName" |
632 | 1722 |
|
633 | 1723 |
aFileName isNil ifTrue: [^nil]. |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1724 |
(image notNil and:[image mask notNil]) ifTrue:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1725 |
image mask fileName:aFileName. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1726 |
self saveImageOrMask: #mask |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1727 |
] ifFalse:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1728 |
self warn: 'No image or image mask detected!!' |
627 | 1729 |
] |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1730 |
|
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1731 |
"Modified: / 30.9.1998 / 23:06:24 / cg" |
628 | 1732 |
! |
1733 |
||
632 | 1734 |
saveImageOrMask: what |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1735 |
"save the image or the mask only (if what == #mask)" |
628 | 1736 |
|
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1737 |
|fileName| |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1738 |
|
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1739 |
Object errorSignal handle:[:ex| |
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1740 |
|msg| |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1741 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1742 |
ex signal == Image fileCreationErrorSignal ifTrue:[ |
1896 | 1743 |
msg := resources string:'Cannot create file: ''%1''' with:fileName asFilename pathName allBold |
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1744 |
] ifFalse:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1745 |
msg := ex errorString. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1746 |
]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1747 |
Dialog warn:msg. |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1748 |
] do:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1749 |
Image informationLostQuerySignal handle:[:ex| |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1750 |
"/ should make those warnings visible ... |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1751 |
(self confirm:(ex errorString , '\\Save anyway ?') withCRs) ifTrue:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1752 |
ex proceed. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1753 |
] |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1754 |
] do:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1755 |
windowGroup withCursor:Cursor write do:[ |
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1756 |
|suff fn| |
1027
5bffbe90b8e2
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
1757 |
|
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1758 |
image isNil ifTrue:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1759 |
^ self error: 'No image to save!!' |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1760 |
]. |
632 | 1761 |
|
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1762 |
what = #image ifTrue:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1763 |
(fileName := image fileName) isNil ifTrue: [^self error: 'No file name for image detected!!']. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1764 |
]. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1765 |
what = #mask ifTrue:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1766 |
image mask isNil ifTrue: [^self error: 'No image mask to save!!']. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1767 |
(fileName := image mask fileName) isNil ifTrue: [^self error: 'No file name for image mask detected!!']. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1768 |
]. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1769 |
fileName := fileName asFilename. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1770 |
|
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1771 |
fileName name size = 0 ifTrue: [^self error: 'No file name detected!!']. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1772 |
suff := fileName suffix asLowercase. |
1373
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1773 |
imageReaderClass := nil. |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1774 |
imageReaderClass := MIMETypes imageReaderForSuffix:suff. |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1775 |
"/ (suff = 'tiff' or:[suff = 'tif']) ifTrue: [ |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1776 |
"/ imageReaderClass := TIFFReader |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1777 |
"/ ] ifFalse:[ |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1778 |
"/ suff = 'xpm' ifTrue: [ |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1779 |
"/ imageReaderClass := XPMReader |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1780 |
"/ ] ifFalse:[ |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1781 |
"/ suff = 'xbm' ifTrue: [ |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1782 |
"/ imageReaderClass := XBMReader |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1783 |
"/ ] ifFalse:[ |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1784 |
"/ suff = 'gif' ifTrue: [ |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1785 |
"/ imageReaderClass := GIFReader |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1786 |
"/ ] ifFalse:[ |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1787 |
"/ (suff = 'jpg' or:[suff = 'jpeg']) ifTrue: [ |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1788 |
"/ imageReaderClass := JPEGReader |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1789 |
"/ ]. |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1790 |
"/ ] |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1791 |
"/ ] |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1792 |
"/ ] |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1793 |
"/ ]. |
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1794 |
|
1373
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1795 |
imageReaderClass isNil ifTrue: [ |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1796 |
imageReaderClass := XPMReader. |
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1797 |
image fileName:(fileName := image fileName, '.xpm'). |
1373
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1798 |
Dialog warn:(('Dont know how to write ''.' , suff , '''-files\\Saving in xpm format as ''%1''.') |
1896 | 1799 |
withCRs bindWith:image fileName allBold). |
1373
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1800 |
]. |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1801 |
(imageReaderClass canRepresent:image) ifFalse:[ |
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1802 |
imageReaderClass := XPMReader. |
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1803 |
image fileName:(fileName := image fileName, '.xpm'). |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1804 |
Dialog warn:(('Saving in ''.' , suff , '''-format is not supported\\Saving in xpm format as ''%1''.') |
1896 | 1805 |
withCRs bindWith:image fileName allBold). |
1373
c949e9f7757c
give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
1806 |
]. |
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1807 |
Transcript showCR:('saving as:' , fileName asFilename pathName). |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1808 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1809 |
what = #image ifTrue: [image saveOn:fileName using: imageReaderClass. modified := false]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1810 |
what = #mask ifTrue: [image mask saveOn:fileName using: imageReaderClass]. |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1811 |
|
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1812 |
fileName asFilename exists ifFalse:[ |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1813 |
Dialog warn:'Oops image save failed.' |
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1814 |
] |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1815 |
] |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1816 |
] |
1027
5bffbe90b8e2
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
1817 |
] |
5bffbe90b8e2
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
1818 |
|
1380
3b343d2e69ef
fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
1819 |
"Modified: / 18.5.1999 / 19:46:54 / cg" |
633 | 1820 |
! |
1821 |
||
1822 |
saveMethod |
|
1823 |
||
1824 |
Object errorSignal handle: |
|
1825 |
[:ex| |
|
1882
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1826 |
self warn: ex errorString. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1827 |
^nil |
633 | 1828 |
] |
1829 |
do: |
|
1830 |
[ |
|
1882
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1831 |
|category imageStoreStream cls sel mthd imageKey| |
822
cace81f0a86b
do not overwrite method categories + toggle between mouse button colors
tz
parents:
796
diff
changeset
|
1832 |
|
1882
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1833 |
windowGroup withExecuteCursorDo:[ |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1834 |
(self resourceSelector trimBlanks size = 0) | (cls := Smalltalk at: self resourceClass) isClass not |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1835 |
ifTrue: [^self saveMethodAs]. |
822
cace81f0a86b
do not overwrite method categories + toggle between mouse button colors
tz
parents:
796
diff
changeset
|
1836 |
|
1882
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1837 |
self class |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1838 |
generateImageSpecMethodFor:self image |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1839 |
comment:(ResourceSpecEditor codeGenerationCommentForClass: ImageEditor) |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1840 |
inClass:cls class |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1841 |
selector:self resourceSelector. |
822
cace81f0a86b
do not overwrite method categories + toggle between mouse button colors
tz
parents:
796
diff
changeset
|
1842 |
|
1901
b4b286ec221f
flush cached icons, when defining a new image-method
Claus Gittinger <cg@exept.de>
parents:
1896
diff
changeset
|
1843 |
"/ flush cache images in the Icon class (kludge) |
b4b286ec221f
flush cached icons, when defining a new image-method
Claus Gittinger <cg@exept.de>
parents:
1896
diff
changeset
|
1844 |
Icon flushCachedIcons. |
b4b286ec221f
flush cached icons, when defining a new image-method
Claus Gittinger <cg@exept.de>
parents:
1896
diff
changeset
|
1845 |
|
1882
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1846 |
"/ self image storeOn: (imageStoreStream := WriteStream on: ''). |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1847 |
"/ sel := self resourceSelector. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1848 |
"/ |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1849 |
"/ "/ if that method already exists, do not overwrite the category |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1850 |
"/ category := 'image specs'. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1851 |
"/ (mthd := cls class compiledMethodAt:sel) notNil ifTrue:[ |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1852 |
"/ category := mthd category. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1853 |
"/ ]. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1854 |
"/ |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1855 |
"/ imageKey := (cls name, ' ', sel) asSymbol. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1856 |
"/ Icon constantNamed: imageKey put:nil. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1857 |
"/ ByteCodeCompiler |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1858 |
"/ compile: ((sel, |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1859 |
"/ '\', (ResourceSpecEditor codeGenerationCommentForClass: ImageEditor), |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1860 |
"/ '\\' , |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1861 |
"/ ' "\', |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1862 |
"/ ' self ' , self resourceSelector , ' inspect\', |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1863 |
"/ ' ImageEditor openOnClass:self andSelector:#', self resourceSelector, |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1864 |
"/ '\ "', |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1865 |
"/ '\\', |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1866 |
"/ ' <resource: #image>', |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1867 |
"/ '\\', |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1868 |
"/ ' ^Icon\') withCRs, |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1869 |
"/ ' constantNamed:#''', imageKey, '''\' withCRs, |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1870 |
"/ ' ifAbsentPut:[', imageStoreStream contents, ']') |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1871 |
"/ forClass: cls class inCategory: category. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1872 |
modified := false. |
fbb4a3a869f1
made image-method generator a class method (for reusability)
martin
parents:
1875
diff
changeset
|
1873 |
] |
633 | 1874 |
] |
1027
5bffbe90b8e2
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
1875 |
|
1047 | 1876 |
"Modified: / 31.7.1998 / 20:12:54 / cg" |
633 | 1877 |
! |
1878 |
||
1879 |
saveMethodAs |
|
1880 |
||
636 | 1881 |
(self resourceMessage: |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1882 |
(ResourceSelectionBrowser |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1883 |
request: 'Save Image In Class' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1884 |
onSuperclass: #Object |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1885 |
andClass: self resourceClass |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1886 |
andSelector: self resourceSelector |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1887 |
withResourceTypes: #(image fileImage))) notNil |
633 | 1888 |
ifTrue: |
674 | 1889 |
[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1890 |
^self saveMethod |
674 | 1891 |
]. |
633 | 1892 |
^nil |
1 | 1893 |
! ! |
1894 |
||
161 | 1895 |
!ImageEditView methodsFor:'queries'! |
5 | 1896 |
|
161 | 1897 |
heightOfContents |
1898 |
||
686 | 1899 |
image isNil ifTrue:[^0]. |
1900 |
^(image height * magnification y) rounded |
|
5 | 1901 |
! |
1902 |
||
995 | 1903 |
imageContainsPastePoint: aPoint |
1904 |
||
1905 |
^image notNil and: |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1906 |
[Clipboard notNil and: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1907 |
[((0@0 corner:(image extent) "- 1" - Clipboard extent) containsPoint: (((aPoint - margin + 1) / magnification) floor))]] |
995 | 1908 |
! |
1909 |
||
627 | 1910 |
imageContainsPoint: aPoint |
632 | 1911 |
|
1912 |
^image notNil and: |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1913 |
[((0@0 corner:(image extent) - 1) containsPoint: (((aPoint - margin + 1) / magnification) floor))] |
627 | 1914 |
! |
1915 |
||
783 | 1916 |
imageInfoString |
1917 |
||
1918 |
|imageInfoString usedColors| |
|
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1919 |
|
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1920 |
image isNil ifTrue: [imageInfoString := 'No image loaded.'] |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1921 |
ifFalse: [ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1922 |
image colorMap isNil ifTrue: [usedColors := '?'] ifFalse: [usedColors := image usedColors size]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1923 |
imageInfoString := image width printString, 'x' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1924 |
, image height printString, 'x' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1925 |
, (2 raisedTo: image depth) printString |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1926 |
, (image mask notNil ifTrue: [' (mask + '] ifFalse: ['(']) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1927 |
, usedColors printString |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1928 |
, ' used colors)']. |
783 | 1929 |
|
1930 |
^imageInfoString |
|
1931 |
! |
|
1932 |
||
161 | 1933 |
widthOfContents |
5 | 1934 |
|
686 | 1935 |
image isNil ifTrue:[^0]. |
1936 |
^(image width * magnification x) rounded |
|
5 | 1937 |
! ! |
1938 |
||
627 | 1939 |
!ImageEditView methodsFor:'release'! |
1940 |
||
995 | 1941 |
releasePasteDrawing |
1942 |
||
1943 |
(lastPastePoint notNil and: [ClipboardMagnification notNil]) |
|
1944 |
ifTrue: |
|
1945 |
[ |
|
1449 | 1946 |
self redraw: (lastPastePoint extent: (ClipboardMagnification extent)). |
995 | 1947 |
]. |
1948 |
lastPastePoint := ClipboardMagnification := nil |
|
1949 |
! |
|
1950 |
||
1951 |
releaseUndos |
|
1952 |
||
1953 |
undoImages removeAll. |
|
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
1954 |
"/ cg: what a kludge - please change to use a valueHolder, |
1374 | 1955 |
"/ masterApplication notNil ifTrue:[ |
1956 |
"/ masterApplication valueOfCanUndo value: false. |
|
1957 |
"/ ]. |
|
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
1958 |
|
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
1959 |
"Modified: / 31.7.1998 / 02:47:21 / cg" |
627 | 1960 |
! ! |
1961 |
||
632 | 1962 |
!ImageEditView methodsFor:'testing'! |
1963 |
||
1964 |
checkModified |
|
1965 |
||
1966 |
modified |
|
1967 |
ifTrue: |
|
1968 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1969 |
((YesNoBox title:(resources string:'Image was modified !!')) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1970 |
noText:(resources string:'Cancel'); |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1971 |
yesText:(resources string:'Forget it and proceed'); |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1972 |
showAtPointer; |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1973 |
accepted) ifFalse: [^false]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1974 |
modified := false |
632 | 1975 |
]. |
1976 |
^true |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1977 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1978 |
"Modified: / 29.7.1998 / 18:55:24 / cg" |
632 | 1979 |
! ! |
1980 |
||
255 | 1981 |
!ImageEditView class methodsFor:'documentation'! |
161 | 1982 |
|
1983 |
version |
|
1903 | 1984 |
^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.142 2000-12-11 10:33:13 cg Exp $' |
161 | 1985 |
! ! |
1245 | 1986 |
ImageEditView initialize! |