author | Claus Gittinger <cg@exept.de> |
Tue, 29 May 2007 19:32:37 +0200 | |
changeset 4768 | f61bf4ab2fba |
parent 4642 | 9eb7fed99649 |
child 4770 | 770e19fa6f50 |
permissions | -rw-r--r-- |
0 | 1 |
" |
6 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
78 | 3 |
All Rights Reserved |
0 | 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 |
" |
|
3192 | 12 |
"{ Package: 'stx:libview' }" |
13 |
||
721
ba7861418087
renamed DisplayMedium to Graphicsmedium & changed inheritance
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
14 |
GraphicsMedium subclass:#Form |
412
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
15 |
instanceVariableNames:'depth localColorMap offset data fileName' |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
16 |
classVariableNames:'VeryLightGreyForm LightGreyForm GreyForm DarkGreyForm |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
17 |
VeryDarkGreyForm AdditionalBitmapDirectoryNames |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
18 |
BlackAndWhiteColorMap DitherPatternArray' |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
19 |
poolDictionaries:'' |
3921 | 20 |
category:'Compatibility-ST80-Graphics-Display Objects' |
0 | 21 |
! |
22 |
||
1907
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
23 |
DeviceHandle subclass:#DeviceFormHandle |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
24 |
instanceVariableNames:'' |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
25 |
classVariableNames:'' |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
26 |
poolDictionaries:'' |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
27 |
privateIn:Form |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
28 |
! |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
29 |
|
4173
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
30 |
Form subclass:#ImageForm |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
31 |
instanceVariableNames:'' |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
32 |
classVariableNames:'' |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
33 |
poolDictionaries:'' |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
34 |
privateIn:Form |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
35 |
! |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
36 |
|
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
37 |
!Form class methodsFor:'documentation'! |
46 | 38 |
|
39 |
copyright |
|
40 |
" |
|
41 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
78 | 42 |
All Rights Reserved |
0 | 43 |
|
46 | 44 |
This software is furnished under a license and may be used |
45 |
only in accordance with the terms of that license and with the |
|
46 |
inclusion of the above copyright notice. This software may not |
|
47 |
be provided or otherwise made available to, or used by, any |
|
48 |
other person. No title to or ownership of the software is |
|
49 |
hereby transferred. |
|
50 |
" |
|
51 |
! |
|
52 |
||
53 |
documentation |
|
54 |
" |
|
55 |
Instances of this class represent forms (i.e. bit- and pixmaps) |
|
590 | 56 |
which can be created on a drawing device. |
57 |
In X, these device resources are XPixmaps. |
|
46 | 58 |
Not all devices will support forms. |
134 | 59 |
|
60 |
NOTICE: |
|
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
61 |
the Form class is a historic leftover and now only used for real |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
62 |
device forms (i.e. on devices which support downloading bitmaps). |
590 | 63 |
|
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
64 |
In your application, you should always use Image, both for compatibility |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
65 |
with ST-80 and for device independence, since Form may not be supported |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
66 |
by all devices. |
589 | 67 |
|
935 | 68 |
WARNING: |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
69 |
Forms created on some device may not be recreatable, when an |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
70 |
image is restarted on a display with different display capabilities. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
71 |
For example, a 24bit truecolor form will be lost when the image is |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
72 |
saved and restarted in an 8bit or monochrome display. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
73 |
Worse: the information is completely lost. |
935 | 74 |
|
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
75 |
With images, the original information is always preserved, although |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
76 |
the display may be with less resolution, dithered or otherwise |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
77 |
approximated. |
935 | 78 |
|
591 | 79 |
[See also:] |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
80 |
Image DeviceDrawable |
610 | 81 |
|
82 |
[author:] |
|
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
83 |
Claus Gittinger |
46 | 84 |
" |
85 |
! ! |
|
0 | 86 |
|
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
87 |
!Form class methodsFor:'initialization'! |
0 | 88 |
|
889 | 89 |
flushDeviceForms |
90 |
"recreate all forms on aDevice; called by Workstation, to |
|
91 |
have all background bitmaps at hand, when views are restored" |
|
92 |
||
93 |
Lobby do:[:aDrawable | |
|
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
94 |
aDrawable isForm ifTrue:[ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
95 |
(aDrawable graphicsDevice notNil) ifTrue:[ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
96 |
"now, try to recreate it" |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
97 |
aDrawable recreate. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
98 |
] |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
99 |
] |
889 | 100 |
] |
101 |
||
102 |
"Created: 18.6.1996 / 13:04:59 / cg" |
|
927
c4bc2a7ff733
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
103 |
"Modified: 5.7.1996 / 17:56:02 / cg" |
889 | 104 |
! |
105 |
||
0 | 106 |
initialize |
126 | 107 |
"initialize set of dictionaries to look for bitmaps" |
0 | 108 |
|
109 |
AdditionalBitmapDirectoryNames isNil ifTrue:[ |
|
4437 | 110 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
111 |
] ifFalse:[ |
|
112 |
AdditionalBitmapDirectoryNames := #('/usr/lib/X11/bitmaps'). |
|
113 |
]. |
|
114 |
]. |
|
115 |
||
116 |
"want to be informed when returning from snapshot" |
|
117 |
ObjectMemory addDependent:self. |
|
0 | 118 |
! |
119 |
||
120 |
reinitializeAllOn:aDevice |
|
121 |
"recreate all forms on aDevice; called by Workstation, to |
|
122 |
have all background bitmaps at hand, when views are restored" |
|
123 |
||
127 | 124 |
Lobby do:[:aDrawable | |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
125 |
(aDrawable graphicsDevice == aDevice) ifTrue:[ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
126 |
aDrawable isForm ifTrue:[ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
127 |
"now, try to recreate it" |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
128 |
aDrawable recreate. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
129 |
] |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
130 |
] |
0 | 131 |
] |
927
c4bc2a7ff733
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
132 |
|
c4bc2a7ff733
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
133 |
"Modified: 5.7.1996 / 17:55:58 / cg" |
0 | 134 |
! |
135 |
||
870
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
136 |
update:something with:aParameter from:changedObject |
0 | 137 |
"sent just before snapOut and just after a snapIn" |
138 |
||
139 |
(something == #save) ifTrue:[ |
|
2823
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
140 |
"get all bits from the device into saveable arrays" |
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
141 |
Lobby do:[:aDrawable | |
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
142 |
aDrawable isForm ifTrue:[ |
4612
4c7d5914930b
oops - did not work when no XWorkstation was available
Claus Gittinger <cg@exept.de>
parents:
4563
diff
changeset
|
143 |
(PrimitiveFailureSignal , DeviceWorkstation drawingOnClosedDeviceSignal) handle:[:ex | |
2823
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
144 |
'Form [warning]: cannot fetch form bits from device' errorPrintCR |
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
145 |
] do:[ |
2933
fd5033d6a182
ask device, if it wants to be made persistent in the snapshot image
Claus Gittinger <cg@exept.de>
parents:
2850
diff
changeset
|
146 |
|dev| |
fd5033d6a182
ask device, if it wants to be made persistent in the snapshot image
Claus Gittinger <cg@exept.de>
parents:
2850
diff
changeset
|
147 |
|
fd5033d6a182
ask device, if it wants to be made persistent in the snapshot image
Claus Gittinger <cg@exept.de>
parents:
2850
diff
changeset
|
148 |
((dev := aDrawable device) isNil |
fd5033d6a182
ask device, if it wants to be made persistent in the snapshot image
Claus Gittinger <cg@exept.de>
parents:
2850
diff
changeset
|
149 |
or:[dev isPersistentInSnapshot]) ifTrue:[ |
fd5033d6a182
ask device, if it wants to be made persistent in the snapshot image
Claus Gittinger <cg@exept.de>
parents:
2850
diff
changeset
|
150 |
aDrawable getBits |
fd5033d6a182
ask device, if it wants to be made persistent in the snapshot image
Claus Gittinger <cg@exept.de>
parents:
2850
diff
changeset
|
151 |
] |
2823
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
152 |
] |
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
153 |
] |
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
154 |
] |
0 | 155 |
]. |
156 |
(something == #restarted) ifTrue:[ |
|
2823
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
157 |
"remove all left-over device info" |
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
158 |
Lobby do:[:aDrawable | |
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
159 |
aDrawable isForm ifTrue:[ |
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
160 |
aDrawable flushDeviceHandles. |
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
161 |
Lobby registerChange:aDrawable |
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
162 |
] |
c10e30bad607
catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
163 |
] |
0 | 164 |
] |
870
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
165 |
|
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
166 |
"Modified: 15.6.1996 / 15:44:09 / cg" |
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
167 |
"Created: 15.6.1996 / 15:47:50 / cg" |
0 | 168 |
! ! |
169 |
||
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
170 |
!Form class methodsFor:'instance creation'! |
278 | 171 |
|
2964 | 172 |
dotOfSize:size |
173 |
"create and return a form which contains a dot (filled circle) |
|
174 |
of the given size." |
|
175 |
||
176 |
|f| |
|
177 |
||
178 |
f := self extent:size asPoint on:Screen current. |
|
179 |
f clear. |
|
180 |
f fillCircle:(f center) radius:(f width min:f height) // 2. |
|
181 |
^ f |
|
182 |
||
183 |
" |
|
184 |
(Form dotOfSize:8) inspect |
|
185 |
(Form dotOfSize:20) inspect |
|
186 |
" |
|
187 |
! |
|
188 |
||
278 | 189 |
extent:ext |
190 |
"create a new, cleared form, take dimensions from ext. |
|
191 |
Smalltalk-80 compatibility" |
|
192 |
||
193 |
|newForm| |
|
194 |
||
195 |
newForm := self width:(ext x) height:(ext y). |
|
196 |
newForm fill:(Color colorId:0). |
|
197 |
newForm paint:(Color colorId:1). |
|
198 |
^ newForm |
|
199 |
! |
|
200 |
||
1278 | 201 |
extent:ext depth:d |
202 |
"create a new, cleared form. |
|
203 |
Smalltalk-80 compatibility" |
|
204 |
||
205 |
^ self width:ext x height:ext y depth:d |
|
206 |
||
207 |
"Created: 27.1.1997 / 16:08:37 / cg" |
|
208 |
"Modified: 27.1.1997 / 16:08:50 / cg" |
|
209 |
! |
|
210 |
||
1548 | 211 |
extent:ext depth:d on:aDevice |
212 |
"create a new form on device, aDevice; depth is what device likes most" |
|
213 |
||
4768 | 214 |
self obsoleteMethodWarning:'use #extent:depth:onDevice:'. |
1549 | 215 |
^ self width:ext x height:ext y depth:d on:aDevice |
1548 | 216 |
|
4768 | 217 |
"Created: / 04-04-1997 / 20:23:32 / cg" |
218 |
"Modified: / 27-05-2007 / 12:39:51 / cg" |
|
1548 | 219 |
! |
220 |
||
3452 | 221 |
extent:ext depth:d onDevice:aDevice |
222 |
"create a new form on device, aDevice; depth is what device likes most" |
|
223 |
||
224 |
^ self width:ext x height:ext y depth:d onDevice:aDevice |
|
225 |
||
226 |
"Created: 4.4.1997 / 20:23:32 / cg" |
|
227 |
"Modified: 4.4.1997 / 20:25:28 / cg" |
|
228 |
! |
|
229 |
||
278 | 230 |
extent:ext fromArray:data |
231 |
"create a new form, take dimensions from ext, bits from data. |
|
232 |
Smalltalk-80 compatibility." |
|
233 |
||
234 |
^ self width:(ext x) height:(ext y) offset:0@0 fromArray:data |
|
235 |
! |
|
236 |
||
237 |
extent:ext fromArray:data offset:offs |
|
238 |
"create a new form, take dimensions from ext, bits from data. |
|
239 |
Smalltalk-80 compatibility." |
|
240 |
||
241 |
^ self width:(ext x) height:(ext y) offset:offs fromArray:data |
|
242 |
! |
|
243 |
||
1571 | 244 |
extent:ext fromArray:data offset:offs on:aDevice |
245 |
"create a new form, take dimensions from ext, bits from data." |
|
246 |
||
4768 | 247 |
self obsoleteMethodWarning:'use #extent:fromArray:offset:onDevice:'. |
1571 | 248 |
^ self width:(ext x) height:(ext y) offset:offs fromArray:data on:aDevice |
249 |
||
4768 | 250 |
"Created: / 10-04-1997 / 15:36:31 / cg" |
251 |
"Modified: / 27-05-2007 / 12:42:26 / cg" |
|
1571 | 252 |
! |
253 |
||
3452 | 254 |
extent:ext fromArray:data offset:offs onDevice:aDevice |
255 |
"create a new form, take dimensions from ext, bits from data." |
|
256 |
||
257 |
^ self width:(ext x) height:(ext y) offset:offs fromArray:data onDevice:aDevice |
|
258 |
||
259 |
"Created: 10.4.1997 / 15:36:31 / cg" |
|
260 |
! |
|
261 |
||
1571 | 262 |
extent:ext fromArray:data on:aDevice |
263 |
"create a new form, take dimensions from ext, bits from data." |
|
264 |
||
4768 | 265 |
self obsoleteMethodWarning:'use #extent:fromArray:onDevice:'. |
1571 | 266 |
^ self width:(ext x) height:(ext y) fromArray:data on:aDevice |
267 |
||
4768 | 268 |
"Created: / 10-04-1997 / 15:34:34 / cg" |
269 |
"Modified: / 27-05-2007 / 12:41:57 / cg" |
|
1571 | 270 |
! |
271 |
||
3452 | 272 |
extent:ext fromArray:data onDevice:aDevice |
273 |
"create a new form, take dimensions from ext, bits from data." |
|
274 |
||
275 |
^ self width:(ext x) height:(ext y) fromArray:data onDevice:aDevice |
|
276 |
||
277 |
"Created: 10.4.1997 / 15:34:34 / cg" |
|
278 |
"Modified: 10.4.1997 / 15:36:04 / cg" |
|
279 |
! |
|
280 |
||
278 | 281 |
extent:ext offset:anOffset |
282 |
"create a new, cleared form, take dimensions from ext. |
|
283 |
Smalltalk-80 compatibility" |
|
284 |
||
285 |
^ (self extent:ext) offset:anOffset. |
|
286 |
! |
|
287 |
||
1548 | 288 |
extent:ext on:aDevice |
289 |
"create a new form on device, aDevice; depth is what device likes most" |
|
290 |
||
4768 | 291 |
self obsoleteMethodWarning:'use #extent:onDevice:'. |
1549 | 292 |
^ self width:ext x height:ext y on:aDevice |
1548 | 293 |
|
4768 | 294 |
"Modified: / 27-05-2007 / 12:41:42 / cg" |
1548 | 295 |
! |
296 |
||
3452 | 297 |
extent:ext onDevice:aDevice |
298 |
"create a new form on device, aDevice; depth is what device likes most" |
|
299 |
||
300 |
^ self width:ext x height:ext y onDevice:aDevice |
|
301 |
||
302 |
"Modified: 4.4.1997 / 20:25:07 / cg" |
|
303 |
! |
|
304 |
||
278 | 305 |
width:w height:h |
306 |
"create a new form on the default device" |
|
307 |
||
3135
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
308 |
|scr| |
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
309 |
|
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
310 |
Screen notNil ifTrue:[scr := Screen current]. |
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
311 |
^ self width:w height:h on:scr |
789 | 312 |
|
313 |
"Modified: 4.6.1996 / 22:16:33 / cg" |
|
278 | 314 |
! |
315 |
||
316 |
width:w height:h depth:d |
|
317 |
"create a new form on the default device" |
|
318 |
||
3135
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
319 |
|scr| |
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
320 |
|
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
321 |
Screen notNil ifTrue:[scr := Screen current]. |
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
322 |
^ self width:w height:h depth:d on:scr |
789 | 323 |
|
324 |
"Modified: 4.6.1996 / 22:16:51 / cg" |
|
278 | 325 |
! |
326 |
||
327 |
width:w height:h depth:d on:aDevice |
|
328 |
"create a new form with depth d on device, aDevice" |
|
329 |
||
4768 | 330 |
self obsoleteMethodWarning:'use #width:height:depth:onDevice:'. |
1255 | 331 |
^ (self onDevice:aDevice) width:w height:h depth:d |
332 |
||
4768 | 333 |
"Modified: / 27-05-2007 / 12:40:25 / cg" |
278 | 334 |
! |
335 |
||
3452 | 336 |
width:w height:h depth:d onDevice:aDevice |
337 |
"create a new form with depth d on device, aDevice" |
|
338 |
||
339 |
^ (self onDevice:aDevice) width:w height:h depth:d |
|
340 |
||
341 |
"Modified: 18.1.1997 / 18:26:03 / cg" |
|
342 |
! |
|
343 |
||
278 | 344 |
width:w height:h fromArray:anArray |
345 |
"create a new form on the default device" |
|
346 |
||
3135
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
347 |
|scr| |
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
348 |
|
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
349 |
Screen notNil ifTrue:[scr := Screen current]. |
4768 | 350 |
^ self width:w height:h fromArray:anArray onDevice:scr |
351 |
||
352 |
"Modified: / 29-05-2007 / 19:31:14 / cg" |
|
278 | 353 |
! |
354 |
||
355 |
width:w height:h fromArray:anArray on:aDevice |
|
356 |
"create a new form on device, aDevice and |
|
357 |
initialize the pixels from anArray" |
|
358 |
||
4768 | 359 |
self obsoleteMethodWarning:'use #width:height:fromArray:onDevice:'. |
1255 | 360 |
^ (self onDevice:aDevice) width:w height:h fromArray:anArray |
361 |
||
4768 | 362 |
"Modified: / 27-05-2007 / 12:40:41 / cg" |
278 | 363 |
! |
109 | 364 |
|
3452 | 365 |
width:w height:h fromArray:anArray onDevice:aDevice |
366 |
"create a new form on device, aDevice and |
|
367 |
initialize the pixels from anArray" |
|
368 |
||
369 |
^ (self onDevice:aDevice) width:w height:h fromArray:anArray |
|
370 |
||
371 |
"Modified: 18.1.1997 / 18:26:24 / cg" |
|
372 |
! |
|
373 |
||
278 | 374 |
width:w height:h offset:offs fromArray:anArray |
375 |
"create a new form on the default device" |
|
376 |
||
3135
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
377 |
|scr| |
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
378 |
|
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
379 |
Screen notNil ifTrue:[scr := Screen current]. |
f9304f22f07b
handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents:
3106
diff
changeset
|
380 |
^ self width:w height:h offset:offs fromArray:anArray on:scr |
1255 | 381 |
|
278 | 382 |
! |
383 |
||
1571 | 384 |
width:w height:h offset:offs fromArray:anArray on:aDevice |
385 |
"create a new form on the default device" |
|
386 |
||
4768 | 387 |
self obsoleteMethodWarning:'use #width:height:offset:fromArray:onDevice:'. |
1571 | 388 |
^ (self onDevice:aDevice) width:w height:h offset:offs fromArray:anArray |
389 |
||
4768 | 390 |
"Created: / 10-04-1997 / 15:35:07 / cg" |
391 |
"Modified: / 27-05-2007 / 12:41:17 / cg" |
|
1571 | 392 |
! |
393 |
||
3452 | 394 |
width:w height:h offset:offs fromArray:anArray onDevice:aDevice |
395 |
"create a new form on the default device" |
|
396 |
||
397 |
^ (self onDevice:aDevice) width:w height:h offset:offs fromArray:anArray |
|
398 |
||
399 |
"Modified: 18.1.1997 / 18:26:28 / cg" |
|
400 |
"Created: 10.4.1997 / 15:35:07 / cg" |
|
401 |
! |
|
402 |
||
278 | 403 |
width:w height:h on:aDevice |
404 |
"create a new form on device, aDevice; depth is what device likes most" |
|
405 |
||
4768 | 406 |
self obsoleteMethodWarning:'use #width:height:onDevice:'. |
1255 | 407 |
^ (self onDevice:aDevice) width:w height:h |
408 |
||
4768 | 409 |
"Modified: / 27-05-2007 / 12:40:57 / cg" |
3452 | 410 |
! |
411 |
||
412 |
width:w height:h onDevice:aDevice |
|
413 |
"create a new form on device, aDevice; depth is what device likes most" |
|
414 |
||
415 |
^ (self onDevice:aDevice) width:w height:h |
|
416 |
||
417 |
"Modified: 18.1.1997 / 18:26:31 / cg" |
|
278 | 418 |
! ! |
419 |
||
3891 | 420 |
!Form class methodsFor:'Compatibility-ST80'! |
278 | 421 |
|
422 |
and |
|
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
423 |
"return a constant usable as bitblt-combinationrule. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
424 |
In ST-80rel2.x, these used to be numeric constants; in ST/X, |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
425 |
these are symbolic." |
278 | 426 |
|
427 |
^ #and |
|
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
428 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
429 |
"Modified: 2.5.1996 / 11:41:23 / cg" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
430 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
431 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
432 |
black |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
433 |
"ST80 compatibility; |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
434 |
In old st80, you could use `Form black' for drawing |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
435 |
- here we return the black color." |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
436 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
437 |
^ Color black |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
438 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
439 |
"Modified: 2.5.1996 / 11:44:17 / cg" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
440 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
441 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
442 |
darkGray |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
443 |
"ST80 compatibility; |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
444 |
In old st80, you could use `Form darkGray' for drawing |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
445 |
- here we return the darkGray color." |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
446 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
447 |
^ Color darkGray |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
448 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
449 |
"Modified: 2.5.1996 / 11:44:06 / cg" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
450 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
451 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
452 |
darkGrey |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
453 |
"ST80 compatibility; |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
454 |
In old st80, you could use `Form darkGrey' for drawing |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
455 |
- here we return the darkGrey color." |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
456 |
|
746 | 457 |
^ Color darkGray |
458 |
||
459 |
"Modified: 28.5.1996 / 20:47:54 / cg" |
|
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
460 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
461 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
462 |
gray |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
463 |
"ST80 compatibility; |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
464 |
In old st80, you could use `Form gray' for drawing |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
465 |
- here we return the grey color." |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
466 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
467 |
^ Color gray |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
468 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
469 |
"Modified: 2.5.1996 / 11:43:44 / cg" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
470 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
471 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
472 |
grey |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
473 |
"ST80 compatibility; |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
474 |
In old st80, you could use `Form grey' for drawing |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
475 |
- here we return the grey color." |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
476 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
477 |
^ Color grey |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
478 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
479 |
"Modified: 2.5.1996 / 11:43:17 / cg" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
480 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
481 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
482 |
lightGray |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
483 |
"ST80 compatibility; |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
484 |
In old st80, you could use `Form lightGray' for drawing |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
485 |
- here we return the lightGray color." |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
486 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
487 |
^ Color lightGray |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
488 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
489 |
"Created: 2.5.1996 / 11:40:07 / cg" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
490 |
"Modified: 2.5.1996 / 11:43:21 / cg" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
491 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
492 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
493 |
lightGrey |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
494 |
"ST80 compatibility; |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
495 |
In old st80, you could use `Form lightGray' for drawing |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
496 |
- here we return the lightGray color." |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
497 |
|
746 | 498 |
^ Color lightGray |
499 |
||
500 |
"Modified: 28.5.1996 / 20:53:28 / cg" |
|
278 | 501 |
! |
502 |
||
503 |
over |
|
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
504 |
"return a constant usable as bitblt-combinationrule. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
505 |
In ST-80rel2.x, these used to be numeric constants; in ST/X, |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
506 |
these are symbolic." |
278 | 507 |
|
508 |
^ #copy |
|
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
509 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
510 |
"Modified: 2.5.1996 / 11:41:31 / cg" |
278 | 511 |
! |
512 |
||
513 |
paint |
|
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
514 |
"return a constant usable as bitblt-combinationrule. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
515 |
In ST-80rel2.x, these used to be numeric constants; in ST/X, |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
516 |
these are symbolic." |
278 | 517 |
|
518 |
^ #copy |
|
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
519 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
520 |
"Modified: 2.5.1996 / 11:41:40 / cg" |
278 | 521 |
! |
522 |
||
523 |
reverse |
|
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
524 |
"return a constant usable as bitblt-combinationrule. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
525 |
In ST-80rel2.x, these used to be numeric constants; in ST/X, |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
526 |
these are symbolic." |
278 | 527 |
|
528 |
^ #xor |
|
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
529 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
530 |
"Modified: 2.5.1996 / 11:41:45 / cg" |
278 | 531 |
! |
532 |
||
533 |
under |
|
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
534 |
"return a constant usable as bitblt-combinationrule. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
535 |
In ST-80rel2.x, these used to be numeric constants; in ST/X, |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
536 |
these are symbolic." |
278 | 537 |
|
538 |
^ #or |
|
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
539 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
540 |
"Modified: 2.5.1996 / 11:41:49 / cg" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
541 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
542 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
543 |
white |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
544 |
"ST80rel2.x compatibility; |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
545 |
In old st80, you could use `Form white' for drawing |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
546 |
- here we return the white color." |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
547 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
548 |
^ Color white |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
549 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
550 |
"Modified: 2.5.1996 / 11:42:50 / cg" |
109 | 551 |
! ! |
552 |
||
3891 | 553 |
!Form class methodsFor:'Compatibility-Squeak'! |
3142 | 554 |
|
4768 | 555 |
extent:ext depth:d bits:data |
556 |
^ self width:(ext x) height:(ext y) offset:0 fromArray:data |
|
557 |
||
558 |
"Created: / 26-05-2007 / 22:35:12 / cg" |
|
559 |
! |
|
560 |
||
3142 | 561 |
extent:ext depth:d fromArray:data offset:offs |
562 |
||
4165
b24a5c2adcb2
Do not use obsolete method #readFromFile: in #onDevice.
Stefan Vogel <sv@exept.de>
parents:
3921
diff
changeset
|
563 |
d ~~ 1 ifTrue:[self error:'unsupported depth' mayProceed:true]. |
b24a5c2adcb2
Do not use obsolete method #readFromFile: in #onDevice.
Stefan Vogel <sv@exept.de>
parents:
3921
diff
changeset
|
564 |
^ self width:(ext x) height:(ext y) offset:offs fromArray:data |
3142 | 565 |
! ! |
566 |
||
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
567 |
!Form class methodsFor:'cleanup'! |
12 | 568 |
|
569 |
lowSpaceCleanup |
|
570 |
"cleanup in low-memory situations" |
|
571 |
||
54 | 572 |
DitherPatternArray := nil |
12 | 573 |
! ! |
574 |
||
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
575 |
!Form class methodsFor:'file search'! |
0 | 576 |
|
577 |
findBitmapFile:fileName |
|
578 |
"find the bitmap file in one of the standard places; |
|
579 |
return the pathName or nil" |
|
580 |
||
4642 | 581 |
|path| |
0 | 582 |
|
583 |
((fileName at:1) == $/) ifTrue:[^ fileName]. |
|
584 |
(fileName startsWith:'../') ifTrue:[^ fileName]. |
|
585 |
(fileName startsWith:'./') ifTrue:[^ fileName]. |
|
127 | 586 |
fileName asFilename exists ifTrue:[^ fileName]. |
0 | 587 |
|
4642 | 588 |
path := Smalltalk getBitmapFileName:fileName. |
589 |
path notNil ifTrue:[ |
|
590 |
^ path |
|
0 | 591 |
]. |
4642 | 592 |
|
0 | 593 |
AdditionalBitmapDirectoryNames notNil ifTrue:[ |
4642 | 594 |
AdditionalBitmapDirectoryNames do:[:aPath | |
595 |
path := aPath , '/' , fileName. |
|
596 |
(OperatingSystem isReadable:path) ifTrue:[ |
|
597 |
^ path |
|
598 |
] |
|
599 |
] |
|
0 | 600 |
]. |
601 |
^ nil |
|
602 |
! ! |
|
603 |
||
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
604 |
!Form class methodsFor:'fileIn/Out'! |
54 | 605 |
|
278 | 606 |
fromFile:filename |
607 |
"create a new form taking the bits from a file on the default device. |
|
608 |
WARNING: |
|
609 |
Please do no longer use this, since it will not work |
|
610 |
correctly in multi-display applications (creates the form on the |
|
611 |
default Display). |
|
612 |
Use #fromFile:on: and pass the devive as argument." |
|
0 | 613 |
|
3431 | 614 |
<resource:#obsolete> |
615 |
||
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
616 |
self obsoleteMethodWarning:'please use Image>>fromFile:'. |
278 | 617 |
^ self fromFile:filename on:Screen current |
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
618 |
|
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
619 |
"Modified: 19.12.1996 / 13:59:09 / cg" |
0 | 620 |
! |
621 |
||
278 | 622 |
fromFile:filename on:aDevice |
623 |
"create a new form on device, aDevice and |
|
624 |
initialize the pixels from the file filename" |
|
0 | 625 |
|
3431 | 626 |
<resource:#obsolete> |
627 |
||
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
628 |
self obsoleteMethodWarning:'please use Image>>fromFile:'. |
1741 | 629 |
^ (self onDevice:aDevice) readFromFile:filename |
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
630 |
|
1741 | 631 |
"Modified: 5.6.1997 / 21:05:59 / cg" |
89 | 632 |
! |
633 |
||
278 | 634 |
fromFile:filename resolution:dpi |
635 |
"create a new form taking the bits from a file on the default device |
|
636 |
the data in the file is assumed to be for dpi resolution; |
|
637 |
if it is different from the displays resolution, magnify or |
|
638 |
shrink the picture (but only in integer magnification steps). |
|
639 |
WARNING: |
|
640 |
Please do no longer use this, since it will not work |
|
641 |
correctly in multi-display applications (creates the form on the |
|
642 |
default Display). |
|
643 |
Use #fromFile:resolution:on: and pass the devive as argument." |
|
98 | 644 |
|
3431 | 645 |
<resource:#obsolete> |
646 |
||
1145 | 647 |
self obsoleteMethodWarning:'please use Image>>fromFile:'. |
1741 | 648 |
^ (self onDevice:Screen current) readFromFile:filename resolution:dpi |
1145 | 649 |
|
1741 | 650 |
"Modified: 5.6.1997 / 21:06:03 / cg" |
0 | 651 |
! |
652 |
||
278 | 653 |
fromFile:filename resolution:dpi on:aDevice |
654 |
"create a new form on device, aDevice and |
|
655 |
initialize the pixels from the file filename; |
|
656 |
the data in the file is assumed to be for dpi resolution; |
|
657 |
if it is different from the displays resolution, magnify or |
|
658 |
shrink the picture (but only in integer magnification steps)" |
|
0 | 659 |
|
3431 | 660 |
<resource:#obsolete> |
661 |
||
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
662 |
self obsoleteMethodWarning:'please use Image>>fromFile:'. |
1741 | 663 |
^ (self onDevice:aDevice) readFromFile:filename resolution:dpi |
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
664 |
|
1741 | 665 |
"Modified: 5.6.1997 / 21:05:54 / cg" |
0 | 666 |
! |
667 |
||
278 | 668 |
readFrom:fileName |
669 |
"same as Form>>fromFile: - for ST-80 compatibility. |
|
670 |
WARNING: |
|
671 |
Please do no longer use this, since it will not work |
|
672 |
correctly in multi-display applications (creates the form on the |
|
673 |
default Display). |
|
4165
b24a5c2adcb2
Do not use obsolete method #readFromFile: in #onDevice.
Stefan Vogel <sv@exept.de>
parents:
3921
diff
changeset
|
674 |
Use #fromFile:on: and pass the device as argument." |
0 | 675 |
|
3431 | 676 |
<resource:#obsolete> |
677 |
||
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
678 |
self obsoleteMethodWarning:'please use Image>>fromFile:'. |
278 | 679 |
^ self fromFile:fileName on:Screen current |
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
680 |
|
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
681 |
"Modified: 19.12.1996 / 13:59:50 / cg" |
0 | 682 |
! ! |
683 |
||
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
684 |
!Form class methodsFor:'obsolete instance creation'! |
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
685 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
686 |
darkGreyFormOn:aDevice |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
687 |
"return a darkGrey form" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
688 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
689 |
|f| |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
690 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
691 |
((aDevice == Display) and:[DarkGreyForm notNil]) ifTrue:[ |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
692 |
^ DarkGreyForm |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
693 |
]. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
694 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
695 |
f := self width:8 height:4 fromArray:(self darkGreyFormBits) on:aDevice. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
696 |
(aDevice == Display) ifTrue:[ |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
697 |
DarkGreyForm := f |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
698 |
]. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
699 |
^ f |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
700 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
701 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
702 |
grey:percent on:aDevice |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
703 |
"return a form for dithering" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
704 |
|
2827 | 705 |
(percent < 20) ifTrue:[^ Color black onDevice:aDevice]. |
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
706 |
(percent < 40) ifTrue:[^ self darkGreyFormOn:aDevice]. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
707 |
(percent < 60) ifTrue:[^ self mediumGreyFormOn:aDevice]. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
708 |
(percent < 80) ifTrue:[^ self lightGreyFormOn:aDevice]. |
2827 | 709 |
^ Color white onDevice:aDevice |
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
710 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
711 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
712 |
lightGreyFormOn:aDevice |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
713 |
"return a lightGrey form" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
714 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
715 |
|f| |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
716 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
717 |
((aDevice == Display) and:[LightGreyForm notNil]) ifTrue:[ |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
718 |
^ LightGreyForm |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
719 |
]. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
720 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
721 |
f := self width:8 height:4 fromArray:(self lightGreyFormBits) on:aDevice. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
722 |
(aDevice == Display) ifTrue:[ |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
723 |
LightGreyForm := f |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
724 |
]. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
725 |
^ f |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
726 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
727 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
728 |
mediumGreyFormOn:aDevice |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
729 |
"return a grey form" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
730 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
731 |
|f| |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
732 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
733 |
((aDevice == Display) and:[GreyForm notNil]) ifTrue:[ |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
734 |
^ GreyForm |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
735 |
]. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
736 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
737 |
f := self width:8 height:4 fromArray:(self greyFormBits) on:aDevice. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
738 |
(aDevice == Display) ifTrue:[ |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
739 |
GreyForm := f |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
740 |
]. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
741 |
^ f |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
742 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
743 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
744 |
veryDarkGreyFormOn:aDevice |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
745 |
"return a veryDarkGrey form" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
746 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
747 |
|f| |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
748 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
749 |
((aDevice == Display) and:[VeryDarkGreyForm notNil]) ifTrue:[ |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
750 |
^ VeryDarkGreyForm |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
751 |
]. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
752 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
753 |
f := self width:8 height:4 fromArray:(self veryDarkGreyFormBits) on:aDevice. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
754 |
(aDevice == Display) ifTrue:[ |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
755 |
VeryDarkGreyForm := f |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
756 |
]. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
757 |
^ f |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
758 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
759 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
760 |
veryLightGreyFormOn:aDevice |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
761 |
"return a veryLightGrey form" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
762 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
763 |
|f| |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
764 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
765 |
((aDevice == Display) and:[VeryLightGreyForm notNil]) ifTrue:[ |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
766 |
^ VeryLightGreyForm |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
767 |
]. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
768 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
769 |
f := self width:8 height:4 fromArray:(self veryLightGreyFormBits) on:aDevice. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
770 |
(aDevice == Display) ifTrue:[ |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
771 |
VeryLightGreyForm := f |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
772 |
]. |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
773 |
^ f |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
774 |
! ! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
775 |
|
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
776 |
!Form class methodsFor:'obsolete patterns'! |
0 | 777 |
|
278 | 778 |
darkGreyFormBits |
779 |
"return a pattern usable to simulate darkGray on monochrome device" |
|
0 | 780 |
|
278 | 781 |
^ #(2r10111011 |
782 |
2r11101110 |
|
783 |
2r10111011 |
|
784 |
2r11101110) |
|
0 | 785 |
! |
786 |
||
632
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
787 |
grey12Bits |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
788 |
"return a pattern with 12% grey, usable for dithering" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
789 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
790 |
^ #(2r00010001 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
791 |
2r00000000 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
792 |
2r01000100 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
793 |
2r00000000) |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
794 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
795 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
796 |
grey25Bits |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
797 |
"return a pattern with 25% grey, usable for dithering" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
798 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
799 |
^ #(2r00010001 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
800 |
2r01000100 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
801 |
2r00010001 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
802 |
2r01000100) |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
803 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
804 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
805 |
grey37Bits |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
806 |
"return a pattern with 37% grey, usable for dithering" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
807 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
808 |
^ #(2r00010001 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
809 |
2r10101010 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
810 |
2r01000100 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
811 |
2r10101010) |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
812 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
813 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
814 |
grey50Bits |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
815 |
"return a pattern with 50% grey, usable for dithering" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
816 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
817 |
^ #(2r01010101 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
818 |
2r10101010 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
819 |
2r01010101 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
820 |
2r10101010) |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
821 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
822 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
823 |
grey6Bits |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
824 |
"return a pattern with 6% grey, usable for dithering" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
825 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
826 |
^ #(2r00000001 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
827 |
2r00000000 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
828 |
2r00010000 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
829 |
2r00000000) |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
830 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
831 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
832 |
greyFormBits |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
833 |
"return a pattern usable to simulate gray on monochrome device" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
834 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
835 |
^ #(2r01010101 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
836 |
2r10101010 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
837 |
2r01010101 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
838 |
2r10101010) |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
839 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
840 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
841 |
lightGreyFormBits |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
842 |
"return a pattern usable to simulate lightGray on monochrome device" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
843 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
844 |
^ #(2r01000100 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
845 |
2r00010001 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
846 |
2r01000100 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
847 |
2r00010001 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
848 |
2r01000100) |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
849 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
850 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
851 |
veryDarkGreyFormBits |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
852 |
"return a pattern usable to simulate veryDarkGray on monochrome device" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
853 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
854 |
^ #(2r01110111 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
855 |
2r11111111 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
856 |
2r11011101 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
857 |
2r11111111) |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
858 |
! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
859 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
860 |
veryLightGreyFormBits |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
861 |
"return a pattern usable to simulate veryDarkGray on monochrome device" |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
862 |
|
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
863 |
^ #(2r10001000 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
864 |
2r00000000 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
865 |
2r00100010 |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
866 |
2r00000000) |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
867 |
! ! |
28cbc6517090
marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents:
610
diff
changeset
|
868 |
|
3880 | 869 |
!Form methodsFor:'Compatibility-ST80'! |
278 | 870 |
|
1520 | 871 |
destroy |
872 |
"destroy my underlying device resource(s)" |
|
1436 | 873 |
|
1520 | 874 |
|id| |
875 |
||
876 |
(id := gcId) notNil ifTrue:[ |
|
877 |
gcId := nil. |
|
878 |
device destroyGC:id. |
|
1508
5d9b6b2524c9
release device resource in close.
Claus Gittinger <cg@exept.de>
parents:
1498
diff
changeset
|
879 |
]. |
5d9b6b2524c9
release device resource in close.
Claus Gittinger <cg@exept.de>
parents:
1498
diff
changeset
|
880 |
|
1520 | 881 |
(id := drawableId) notNil ifTrue:[ |
882 |
drawableId := nil. |
|
883 |
device destroyPixmap:id. |
|
884 |
]. |
|
885 |
||
886 |
Lobby unregister:self. |
|
887 |
||
888 |
"Modified: 2.4.1997 / 19:39:52 / cg" |
|
1436 | 889 |
! |
890 |
||
2964 | 891 |
displayAt:aPoint |
892 |
"show the receiver on the current display screen" |
|
893 |
||
894 |
self displayOn:Screen current rootView at:aPoint |
|
895 |
||
896 |
" |
|
897 |
(Form dotOfSize:8) displayAt:10@10 |
|
898 |
" |
|
899 |
||
900 |
||
901 |
! |
|
902 |
||
278 | 903 |
displayOn:aGC at:aPoint rule:rule |
904 |
"draw in aGC. |
|
905 |
Smalltalk-80 (2.x) compatibility" |
|
906 |
||
672 | 907 |
self displayOn:aGC x:aPoint x y:aPoint y rule:rule |
908 |
||
909 |
"Modified: 12.5.1996 / 20:16:02 / cg" |
|
910 |
! |
|
911 |
||
912 |
displayOn:aGC rule:rule |
|
913 |
"draw in aGC. |
|
914 |
Smalltalk-80 (2.x) compatibility" |
|
915 |
||
916 |
^ self displayOn:aGC x:0 y:0 rule:rule |
|
917 |
||
918 |
"Modified: 12.5.1996 / 20:15:41 / cg" |
|
919 |
! |
|
920 |
||
921 |
displayOn:aGC x:x y:y |
|
922 |
"draw in aGC. |
|
923 |
Smalltalk-80 (2.x) compatibility" |
|
924 |
||
925 |
^ self displayOn:aGC x:x y:y rule:#copy |
|
926 |
||
927 |
"Created: 12.5.1996 / 20:15:05 / cg" |
|
928 |
! |
|
929 |
||
930 |
displayOn:aGC x:x y:y rule:rule |
|
931 |
"draw in aGC. |
|
932 |
Smalltalk-80 (2.x) compatibility" |
|
933 |
||
278 | 934 |
|f| |
935 |
||
936 |
f := aGC function. |
|
937 |
aGC function:rule. |
|
672 | 938 |
aGC displayOpaqueForm:self x:x y:y. |
278 | 939 |
aGC function:f. |
940 |
||
672 | 941 |
"Created: 12.5.1996 / 20:15:26 / cg" |
278 | 942 |
! |
943 |
||
1325 | 944 |
isOpen |
945 |
^ true |
|
946 |
||
947 |
"Created: 10.2.1997 / 12:43:49 / cg" |
|
948 |
! |
|
949 |
||
278 | 950 |
offset |
951 |
"set the offset. |
|
952 |
Smalltalk-80 compatibility" |
|
953 |
||
954 |
^ offset |
|
955 |
! |
|
956 |
||
957 |
offset:org |
|
958 |
"set the offset. |
|
959 |
Smalltalk-80 compatibility" |
|
960 |
||
961 |
offset := org |
|
1325 | 962 |
! |
963 |
||
964 |
preferredBounds |
|
965 |
^ self bounds |
|
966 |
||
967 |
"Created: 10.2.1997 / 12:43:00 / cg" |
|
278 | 968 |
! ! |
969 |
||
3880 | 970 |
!Form methodsFor:'Compatibility-Squeak'! |
3020 | 971 |
|
972 |
colormapIfNeededForDepth:destDepth |
|
973 |
||
974 |
^nil |
|
3025 | 975 |
! |
976 |
||
977 |
magnify:aRectangle by:scale smoothing:smooth |
|
978 |
^ ((Image fromSubForm:aRectangle in:self) magnifiedBy:scale) asFormOn:device. |
|
3020 | 979 |
! ! |
980 |
||
278 | 981 |
!Form methodsFor:'accessing'! |
982 |
||
983 |
bits |
|
984 |
"return a ByteArray filled with my bits - |
|
985 |
for depth 8 forms, 1 pixel/byte is filled; |
|
986 |
for depth 1 forms, 8 pixels/byte are filled |
|
987 |
for depth 4 forms, 2 pixels/byte are filled. |
|
1645 | 988 |
Padding is done row-wise to the next BYTE-boundary |
989 |
If multiple pixels are contained in a single byte, |
|
990 |
left bits are in the most significant bit positions. |
|
278 | 991 |
(i.e. for width==13 and depth==1 it will return 2 bytes per scanline)" |
992 |
||
993 |
|bytesPerLine "{ Class: SmallInteger }" |
|
994 |
bytesPerLineIn "{ Class: SmallInteger }" |
|
995 |
inData tmpData info |
|
996 |
srcIndex "{ Class: SmallInteger }" |
|
997 |
dstIndex "{ Class: SmallInteger }" |
|
2060 | 998 |
buffer spaceBitsPerPixel| |
278 | 999 |
|
1000 |
data notNil ifTrue:[ |
|
1458
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1001 |
^ data |
278 | 1002 |
]. |
1003 |
drawableId isNil ifTrue:[ |
|
1458
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1004 |
fileName notNil ifTrue:[ |
3624 | 1005 |
^ (self onDevice:Screen current) bits |
1458
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1006 |
]. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1007 |
^ nil |
278 | 1008 |
]. |
1009 |
||
2060 | 1010 |
spaceBitsPerPixel := depth. |
1011 |
(depth > 8) ifTrue:[ |
|
1012 |
spaceBitsPerPixel := 16. |
|
1013 |
(depth > 16) ifTrue:[ |
|
1014 |
spaceBitsPerPixel := 32. |
|
1015 |
(depth > 32) ifTrue:[ |
|
1016 |
spaceBitsPerPixel := depth. |
|
1017 |
] |
|
1018 |
] |
|
1019 |
]. |
|
1020 |
||
1021 |
bytesPerLine := (width * spaceBitsPerPixel + 31) // 32 * 4. |
|
278 | 1022 |
inData := ByteArray uninitializedNew:(bytesPerLine * height). |
1461
6d8b022bfcd8
renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents:
1458
diff
changeset
|
1023 |
info := device getBitsFromPixmapId:drawableId x:0 y:0 width:width height:height into:inData. |
398
2b35bb58a82b
changes for new returned info from getBits
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
1024 |
bytesPerLineIn := (info at:#bytesPerLine). "what I got" |
278 | 1025 |
bytesPerLine := (width * depth + 7) // 8. "what I want" |
1026 |
(bytesPerLine ~~ bytesPerLineIn) ifTrue:[ |
|
1458
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1027 |
" |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1028 |
different padding - have to copy over row-wise |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1029 |
" |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1030 |
tmpData := inData. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1031 |
inData := ByteArray uninitializedNew:(bytesPerLine * height). |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1032 |
srcIndex := 1. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1033 |
dstIndex := 1. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1034 |
1 to:height do:[:hi | |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1035 |
inData replaceFrom:dstIndex to:(dstIndex + bytesPerLine - 1) |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1036 |
with:tmpData startingAt:srcIndex. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1037 |
dstIndex := dstIndex + bytesPerLine. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1038 |
srcIndex := srcIndex + bytesPerLineIn |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1039 |
] |
278 | 1040 |
] ifFalse:[ |
1458
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1041 |
" |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1042 |
same padding - copy over all in one chunk |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1043 |
" |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1044 |
(bytesPerLine * height) ~~ inData size ifTrue:[ |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1045 |
tmpData := inData. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1046 |
inData := ByteArray uninitializedNew:(bytesPerLine * height). |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1047 |
inData replaceFrom:1 to:bytesPerLine * height with:tmpData startingAt:1 |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1048 |
] |
278 | 1049 |
]. |
1645 | 1050 |
|
278 | 1051 |
" |
1052 |
have to reverse bytes, if not msbFirst ? |
|
1053 |
" |
|
915 | 1054 |
|
1055 |
"/ (info at:#byteOrder) ~~ #msbFirst ifTrue:[ |
|
1056 |
"/ buffer := ByteArray new:bytesPerLine. |
|
1057 |
"/ dstIndex := 1. |
|
1058 |
"/ 1 to:height do:[:hi | |
|
1059 |
"/ buffer replaceFrom:1 to:bytesPerLine with:inData startingAt:dstIndex. |
|
1060 |
"/ buffer reverse. |
|
1061 |
"/ inData replaceFrom:dstIndex to:dstIndex+bytesPerLine-1 with:buffer startingAt:1. |
|
1062 |
"/ dstIndex := dstIndex + bytesPerLine |
|
1063 |
"/ ] |
|
1064 |
"/ ]. |
|
1645 | 1065 |
|
1066 |
" |
|
1067 |
have to reverse bits, if not msbFirst ? |
|
1068 |
" |
|
398
2b35bb58a82b
changes for new returned info from getBits
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
1069 |
(info at:#bitOrder) ~~ #msbFirst ifTrue:[ |
1458
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1070 |
buffer := ByteArray new:bytesPerLine. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1071 |
dstIndex := 1. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1072 |
1 to:height do:[:hi | |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1073 |
buffer replaceFrom:1 to:bytesPerLine with:inData startingAt:dstIndex. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1074 |
buffer expandPixels:8 width:bytesPerLine height:1 into:buffer |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1075 |
mapping:(ImageReader reverseBits). "/ translate only |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1076 |
inData replaceFrom:dstIndex to:dstIndex+bytesPerLine-1 with:buffer startingAt:1. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1077 |
dstIndex := dstIndex + bytesPerLine |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1078 |
] |
278 | 1079 |
]. |
1080 |
||
1081 |
^ inData. |
|
1458
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1082 |
|
2060 | 1083 |
"Modified: / 19.2.1998 / 14:47:06 / cg" |
278 | 1084 |
! |
1085 |
||
588 | 1086 |
bits:aByteArray |
1087 |
"set the forms bits; |
|
1088 |
for depth-8 forms, 1 pixel/byte is expected; |
|
1089 |
for depth-1 forms, 8 pixels/byte are expected |
|
1090 |
for depth-4 forms, 2 pixels/byte are expected. |
|
1091 |
Padding is expected to the next byte-boundary |
|
1092 |
(i.e. for width==13 and depth==1 2 bytes per scanline are expected)" |
|
1093 |
||
1094 |
data := aByteArray |
|
1095 |
||
1096 |
"Modified: 23.4.1996 / 10:06:01 / cg" |
|
278 | 1097 |
! |
1098 |
||
1099 |
bitsPerSample |
|
1100 |
"for compatibility with Image class ..." |
|
1101 |
||
1102 |
^ Array with:depth |
|
1103 |
! |
|
1104 |
||
1105 |
colorMap |
|
1106 |
"return the receivers colormap" |
|
1107 |
||
1108 |
^ localColorMap |
|
1109 |
! |
|
1110 |
||
1436 | 1111 |
colorMap:anArrayOrColorMap |
278 | 1112 |
"set the receivers colormap" |
1113 |
||
1446
3007549e3d5e
never convert a colorArray to a colorMap
Claus Gittinger <cg@exept.de>
parents:
1436
diff
changeset
|
1114 |
localColorMap := anArrayOrColorMap |
1436 | 1115 |
|
1446
3007549e3d5e
never convert a colorArray to a colorMap
Claus Gittinger <cg@exept.de>
parents:
1436
diff
changeset
|
1116 |
"Modified: 7.3.1997 / 21:26:11 / cg" |
278 | 1117 |
! |
1118 |
||
1119 |
depth |
|
1120 |
"return the receivers depth" |
|
1121 |
||
1122 |
^ depth |
|
1123 |
! |
|
1124 |
||
2456 | 1125 |
fileName |
1126 |
"return the filename, from which the receiver was created, |
|
1127 |
or nil, if it was not read from a file" |
|
1128 |
||
1129 |
^ fileName |
|
1130 |
! |
|
1131 |
||
278 | 1132 |
filename |
1133 |
"return the filename, from which the receiver was created, |
|
1134 |
or nil, if it was not read from a file" |
|
1135 |
||
2456 | 1136 |
"/ going to be obsoleted - use #fileName |
278 | 1137 |
^ fileName |
1138 |
! |
|
1139 |
||
1140 |
forgetBits |
|
1141 |
"for image, which also keeps the bits - so there is |
|
1142 |
no need to hold them again here" |
|
1143 |
||
1144 |
data := nil |
|
1145 |
! |
|
1146 |
||
897 | 1147 |
mask |
1148 |
"for compatibility with images; forms have no mask/alpha channel" |
|
1149 |
||
1150 |
^ nil |
|
1151 |
||
1152 |
"Created: 21.6.1996 / 12:52:42 / cg" |
|
1153 |
! |
|
1154 |
||
278 | 1155 |
photometric |
1156 |
"for compatibility with Image class ..." |
|
1157 |
||
1158 |
depth == 1 ifTrue:[ |
|
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1159 |
localColorMap isNil ifTrue:[ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1160 |
^ #whiteIs0 |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1161 |
]. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1162 |
((localColorMap at:1) = Color white) ifTrue:[ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1163 |
((localColorMap at:2) = Color black) ifTrue:[ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1164 |
^ #whiteIs0 |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1165 |
]. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1166 |
]. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1167 |
((localColorMap at:1) = Color black) ifTrue:[ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1168 |
((localColorMap at:2) = Color white) ifTrue:[ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1169 |
^ #blackIs0 |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1170 |
]. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1171 |
]. |
278 | 1172 |
]. |
1173 |
^ #palette |
|
872 | 1174 |
|
1175 |
"Modified: 17.6.1996 / 11:45:16 / cg" |
|
278 | 1176 |
! |
1177 |
||
1178 |
samplesperPixel |
|
1179 |
"for compatibility with Image class ..." |
|
1180 |
||
1181 |
^ 1 |
|
1182 |
! |
|
1183 |
||
1184 |
valueAt:aPoint |
|
588 | 1185 |
"return the pixel at aPoint; the coordinates start with 0@0 |
1186 |
in the upper left, increasing to the lower right" |
|
1187 |
||
278 | 1188 |
^ self at:aPoint |
588 | 1189 |
|
1190 |
"Modified: 23.4.1996 / 10:06:55 / cg" |
|
278 | 1191 |
! |
1192 |
||
1193 |
valueAt:aPoint put:value |
|
588 | 1194 |
"set the pixel at aPoint; the coordinates start with 0@0 |
1195 |
in the upper left, increasing to the lower right." |
|
1196 |
||
278 | 1197 |
^ self at:aPoint put:value |
588 | 1198 |
|
1199 |
" |
|
1200 |
|f| |
|
1201 |
||
1202 |
f := Form width:10 height:10 depth:1. |
|
1203 |
f clear. |
|
1204 |
1 to:10 do:[:i | |
|
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1205 |
f valueAt:(i @ i) put:1 |
588 | 1206 |
]. |
1207 |
f inspect |
|
1208 |
" |
|
1209 |
||
1210 |
"Modified: 23.4.1996 / 10:12:48 / cg" |
|
278 | 1211 |
! ! |
1212 |
||
4768 | 1213 |
|
278 | 1214 |
!Form methodsFor:'converting'! |
1215 |
||
1216 |
asForm |
|
588 | 1217 |
"convert & return the receiver into a Form instance - nothing to be done here" |
1218 |
||
278 | 1219 |
^ self |
588 | 1220 |
|
1221 |
"Modified: 23.4.1996 / 10:14:11 / cg" |
|
278 | 1222 |
! |
1223 |
||
1224 |
asImage |
|
588 | 1225 |
"convert & return the receiver into an Image instance" |
1226 |
||
278 | 1227 |
^ Image fromForm:self |
588 | 1228 |
|
1229 |
"Modified: 23.4.1996 / 10:13:56 / cg" |
|
4173
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1230 |
! |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1231 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1232 |
asImageForm |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1233 |
"convert & return the receiver into a ImageForm instance" |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1234 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1235 |
|imageForm| |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1236 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1237 |
imageForm := ImageForm cloneFrom:self. |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1238 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1239 |
"kludge: have to unregister. Otherwise the form will be destroyed when |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1240 |
we are garbage collected" |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1241 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1242 |
Lobby unregister:self. |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1243 |
Lobby registerChange:imageForm. |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1244 |
^ imageForm. |
278 | 1245 |
! ! |
1246 |
||
1247 |
!Form methodsFor:'copying'! |
|
1248 |
||
2849 | 1249 |
executor |
1250 |
"redefined for faster creation of finalization copies |
|
1251 |
(only device, gcId and drawableId are needed)" |
|
1252 |
||
1253 |
^ DeviceFormHandle basicNew setDevice:device id:drawableId gcId:gcId. |
|
1254 |
! |
|
1255 |
||
278 | 1256 |
postCopy |
588 | 1257 |
"redefined to copy the colorMap as well" |
1258 |
||
278 | 1259 |
super postCopy. |
1260 |
localColorMap := localColorMap copy. |
|
1261 |
data := data copy |
|
588 | 1262 |
|
1263 |
"Modified: 23.4.1996 / 10:14:46 / cg" |
|
278 | 1264 |
! ! |
1265 |
||
1266 |
!Form methodsFor:'editing'! |
|
1267 |
||
1268 |
show |
|
588 | 1269 |
"open an imageView on the receiver" |
1270 |
||
278 | 1271 |
ImageView openOnImage:self |
1272 |
||
1273 |
" |
|
1274 |
(Form fromFile:'bitmaps/SBrowser.xbm') show |
|
1275 |
" |
|
588 | 1276 |
|
1277 |
"Modified: 23.4.1996 / 10:16:12 / cg" |
|
278 | 1278 |
! ! |
1279 |
||
1280 |
!Form methodsFor:'getting a device form'! |
|
1281 |
||
1282 |
asFormOn:aDevice |
|
588 | 1283 |
"convert & return the receiver into a Form instance |
1284 |
and associate it to a device (i.e. download its bits). |
|
1285 |
Added for protocol compatibility with Image." |
|
1286 |
||
278 | 1287 |
aDevice == device ifTrue:[ |
1889
8e24afd8174e
Send #onDevice instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents:
1745
diff
changeset
|
1288 |
^ self |
278 | 1289 |
]. |
1889
8e24afd8174e
Send #onDevice instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents:
1745
diff
changeset
|
1290 |
^ self onDevice:aDevice |
588 | 1291 |
|
1292 |
"Modified: 23.4.1996 / 10:17:26 / cg" |
|
1889
8e24afd8174e
Send #onDevice instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents:
1745
diff
changeset
|
1293 |
"Modified: 26.8.1997 / 10:29:14 / stefan" |
278 | 1294 |
! |
1295 |
||
1296 |
asMonochromeFormOn:aDevice |
|
588 | 1297 |
"added for protocol compatiblity with Image" |
1298 |
||
278 | 1299 |
aDevice == device ifTrue:[ |
2191 | 1300 |
depth == 1 ifTrue:[ |
1301 |
^ self |
|
1302 |
]. |
|
278 | 1303 |
]. |
1304 |
(depth == 1) ifTrue:[ |
|
2191 | 1305 |
^ self onDevice:aDevice |
278 | 1306 |
]. |
1307 |
^ nil |
|
588 | 1308 |
|
2191 | 1309 |
"Modified: / 27.7.1998 / 20:04:37 / cg" |
278 | 1310 |
! |
1311 |
||
3104
edc88b280153
added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3068
diff
changeset
|
1312 |
exactOn:aDevice |
3106
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1313 |
"for compatibility with color protocol - here, the same as #onDevice." |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1314 |
|
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1315 |
^ self onDevice:aDevice |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1316 |
|
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1317 |
! |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1318 |
|
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1319 |
exactOrNearestOn:aDevice |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1320 |
"for compatibility with color protocol - here, the same as #onDevice." |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1321 |
|
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1322 |
^ self onDevice:aDevice |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1323 |
|
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1324 |
! |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1325 |
|
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1326 |
nearestOn:aDevice |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1327 |
"for compatibility with color protocol - here, the same as #onDevice." |
3104
edc88b280153
added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3068
diff
changeset
|
1328 |
|
edc88b280153
added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3068
diff
changeset
|
1329 |
^ self onDevice:aDevice |
edc88b280153
added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3068
diff
changeset
|
1330 |
|
edc88b280153
added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3068
diff
changeset
|
1331 |
! |
edc88b280153
added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3068
diff
changeset
|
1332 |
|
278 | 1333 |
on:aDevice |
588 | 1334 |
"associate the receiver to a device (i.e. download its bits); |
1335 |
return a deviceForm (possibly different from the receiver)." |
|
1336 |
||
1741 | 1337 |
"/ send out a warning: #on: is typically used to create views |
1338 |
"/ operating on a model. |
|
1339 |
"/ Please use #onDevice: to avoid confusion. |
|
1340 |
||
3431 | 1341 |
<resource:#obsolete> |
1342 |
||
1741 | 1343 |
self obsoleteMethodWarning:'use #onDevice:'. |
1344 |
^ self onDevice:aDevice |
|
1345 |
||
1346 |
"Modified: 5.6.1997 / 21:05:34 / cg" |
|
1347 |
! |
|
1348 |
||
1349 |
onDevice:aDevice |
|
1350 |
"associate the receiver to a device (i.e. download its bits); |
|
1351 |
return a deviceForm (possibly different from the receiver)." |
|
1352 |
||
278 | 1353 |
aDevice == device ifTrue:[ |
1436 | 1354 |
^ self |
278 | 1355 |
]. |
2980
409e9547a45c
ignore nil device in #onDevice:
Claus Gittinger <cg@exept.de>
parents:
2964
diff
changeset
|
1356 |
aDevice isNil ifTrue:[^ self]. |
409e9547a45c
ignore nil device in #onDevice:
Claus Gittinger <cg@exept.de>
parents:
2964
diff
changeset
|
1357 |
|
278 | 1358 |
"create a new form ..." |
1359 |
||
1360 |
data notNil ifTrue:[ |
|
2191 | 1361 |
"/ 'Form [info]: create from data' printCR. |
1436 | 1362 |
^ self class width:width height:height fromArray:data on:aDevice |
278 | 1363 |
]. |
1364 |
fileName notNil ifTrue:[ |
|
2191 | 1365 |
"/ 'Form [info]: create from file' printCR. |
4165
b24a5c2adcb2
Do not use obsolete method #readFromFile: in #onDevice.
Stefan Vogel <sv@exept.de>
parents:
3921
diff
changeset
|
1366 |
^ (Image fromFile:fileName) asFormOn:aDevice |
278 | 1367 |
]. |
2191 | 1368 |
'Form [warning]: no bit data in #onDevice: - returning a black form.' infoPrintCR. |
1436 | 1369 |
^ (self class width:width height:height on:aDevice) clear |
588 | 1370 |
|
2191 | 1371 |
"Modified: / 27.7.1998 / 20:05:20 / cg" |
278 | 1372 |
! ! |
1373 |
||
1374 |
!Form methodsFor:'image manipulations'! |
|
1375 |
||
3655 | 1376 |
clearMaskedPixels |
1377 |
"Added for protocol compatibility with Image." |
|
1378 |
||
1379 |
^ self |
|
1380 |
! |
|
1381 |
||
278 | 1382 |
darkened |
588 | 1383 |
"return a darkened version of the receiver. |
1384 |
Added for protocol compatibility with Color and Image. |
|
1385 |
Here, the receiver is returned as a kludge |
|
1386 |
- actually should return a darkened image (or Color black ?) .." |
|
278 | 1387 |
|
1388 |
^ self |
|
588 | 1389 |
|
1390 |
"Modified: 23.4.1996 / 10:19:52 / cg" |
|
278 | 1391 |
! |
1392 |
||
3334 | 1393 |
easyMagnifiedBy:extent into: newForm |
1394 |
"return a new form magnified by extent, aPoint. |
|
1395 |
If non-integral magnify is asked for, pass the work on to 'hardMagnifiedBy:'" |
|
1396 |
||
1397 |
|mX mY dstX dstY ext |
|
1398 |
factor "{ Class: SmallInteger }" |
|
1399 |
n "{ Class: SmallInteger }" | |
|
1400 |
||
1401 |
ext := extent asPoint. |
|
1402 |
mX := ext x. |
|
1403 |
mY := ext y. |
|
1404 |
((mX = 1) and:[mY = 1]) ifTrue:[^ self]. |
|
1405 |
||
1406 |
"expand rows" |
|
1407 |
(mY > 1) ifTrue:[ |
|
1408 |
dstY := 0. |
|
1409 |
n := height. |
|
1410 |
factor := mY. |
|
1411 |
0 to:(n - 1) do:[:srcY | |
|
1412 |
1 to:factor do:[:i | |
|
1413 |
newForm copyFrom:self |
|
1414 |
x:0 y:srcY |
|
1415 |
toX:0 y:dstY |
|
1416 |
width:width height:1. |
|
1417 |
dstY := dstY + 1 |
|
1418 |
] |
|
1419 |
] |
|
1420 |
]. |
|
1421 |
||
1422 |
"expand cols" |
|
1423 |
(mX > 1) ifTrue:[ |
|
1424 |
n := width. |
|
1425 |
factor := mX. |
|
1426 |
dstX := (n * factor) - 1. |
|
1427 |
(n - 1) to:0 by:-1 do:[:srcX | |
|
1428 |
1 to:factor do:[:i | |
|
1429 |
newForm copyFrom:newForm |
|
1430 |
x:srcX y:0 |
|
1431 |
toX:dstX y:0 |
|
1432 |
width:1 height:(height * mY). |
|
1433 |
dstX := dstX - 1 |
|
1434 |
] |
|
1435 |
] |
|
1436 |
]. |
|
1437 |
^ newForm |
|
1438 |
||
1439 |
" |
|
1440 |
(ArrowButton upArrowButtonForm:#iris on:Display) magnifiedBy:(2 @ 2) |
|
1441 |
(Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(2 @ 2) |
|
1442 |
(Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(0.4 @ 0.4) |
|
1443 |
" |
|
1444 |
! |
|
1445 |
||
278 | 1446 |
flipHorizontal |
4206 | 1447 |
"return a new form flipped vertically" |
1448 |
||
1449 |
|dstX newForm | |
|
278 | 1450 |
|
3624 | 1451 |
newForm := (self class onDevice:device) |
2827 | 1452 |
width:width |
1453 |
height:height |
|
1454 |
depth:depth. |
|
4206 | 1455 |
dstX := width - 1. |
1456 |
0 to:dstX do:[:srcX | |
|
1457 |
newForm copyFrom:self |
|
1458 |
x:srcX y:0 |
|
1459 |
toX:dstX y:0 |
|
1460 |
width:1 height:height. |
|
1461 |
dstX := dstX - 1 |
|
1462 |
]. |
|
1463 |
newForm colorMap:localColorMap. |
|
1464 |
^ newForm |
|
1465 |
||
1466 |
" |
|
1467 |
|testForm| |
|
1468 |
||
1469 |
testForm _ Form |
|
1470 |
extent: 8@8 |
|
1471 |
depth: 1 |
|
1472 |
fromArray: |
|
1473 |
#( 2r10000000 |
|
1474 |
2r11000000 |
|
1475 |
2r11100000 |
|
1476 |
2r11110000 |
|
1477 |
2r11111000 |
|
1478 |
2r11111100 |
|
1479 |
2r11111110 |
|
1480 |
2r11111111) |
|
1481 |
offset: 0@0. |
|
1482 |
testForm inspect. |
|
1483 |
testForm flipVertical inspect. |
|
1484 |
testForm flipHorizontal inspect. |
|
1485 |
" |
|
1486 |
! |
|
1487 |
||
1488 |
flipVertical |
|
1489 |
"return a new form flipped horizontally" |
|
1490 |
||
1491 |
|dstY newForm | |
|
1492 |
||
1493 |
newForm := (self class onDevice:device) |
|
1494 |
width:width |
|
1495 |
height:height |
|
1496 |
depth:depth. |
|
278 | 1497 |
dstY := height - 1. |
4206 | 1498 |
0 to:dstY do:[:srcY | |
2827 | 1499 |
newForm copyFrom:self |
1500 |
x:0 y:srcY |
|
1501 |
toX:0 y:dstY |
|
1502 |
width:width height:1. |
|
1503 |
dstY := dstY - 1 |
|
278 | 1504 |
]. |
1505 |
newForm colorMap:localColorMap. |
|
1506 |
^ newForm |
|
4206 | 1507 |
|
1508 |
" |
|
1509 |
|testForm| |
|
1510 |
||
1511 |
testForm _ Form |
|
1512 |
extent: 8@8 |
|
1513 |
depth: 1 |
|
1514 |
fromArray: |
|
1515 |
#( 2r10000000 |
|
1516 |
2r11000000 |
|
1517 |
2r11100000 |
|
1518 |
2r11110000 |
|
1519 |
2r11111000 |
|
1520 |
2r11111100 |
|
1521 |
2r11111110 |
|
1522 |
2r11111111) |
|
1523 |
offset: 0@0. |
|
1524 |
testForm inspect. |
|
1525 |
testForm flipVertical inspect. |
|
1526 |
testForm flipHorizontal inspect. |
|
1527 |
" |
|
278 | 1528 |
! |
1529 |
||
1530 |
hardMagnifiedBy:extent |
|
1531 |
"return a new form magnified by extent, aPoint. |
|
1532 |
This method handles non-integral factors." |
|
1533 |
||
1534 |
" |
|
1535 |
since Form will be replaced by Image in the long run, |
|
1536 |
and this operation is slow anyway, use the implementation |
|
1537 |
in Image for this." |
|
1538 |
||
1539 |
^ ((Image fromForm:self) magnifiedBy:extent) asFormOn:device. |
|
1540 |
||
1541 |
" |
|
1542 |
(Form fromFile:'OutputOn.64') magnifiedBy:0.5@0.5 |
|
1543 |
(Form fromFile:'OutputOn.64') magnifiedBy:1.5@1.5 |
|
1544 |
" |
|
1545 |
! |
|
1546 |
||
1547 |
lightened |
|
588 | 1548 |
"return a lightened version of the receiver. |
1549 |
Added for protocol compatibility with Color and Image. |
|
1550 |
Here, the receiver is returned as a kludge |
|
1551 |
- actually should return a lightened image (or Color white ?) .." |
|
278 | 1552 |
|
1553 |
^ self |
|
588 | 1554 |
|
1555 |
"Modified: 23.4.1996 / 10:20:14 / cg" |
|
278 | 1556 |
! |
1557 |
||
1558 |
magnifiedBy:extent |
|
1559 |
"return a new form magnified by extent, aPoint. |
|
1560 |
If non-integral magnify is asked for, pass the work on to 'hardMagnifiedBy:'" |
|
1561 |
||
3624 | 1562 |
|mX mY newForm ext| |
278 | 1563 |
|
1564 |
ext := extent asPoint. |
|
1565 |
mX := ext x. |
|
1566 |
mY := ext y. |
|
1567 |
((mX = 1) and:[mY = 1]) ifTrue:[^ self]. |
|
1568 |
||
1569 |
((mX isMemberOf:SmallInteger) and:[mY isMemberOf:SmallInteger]) ifFalse:[ |
|
2827 | 1570 |
^ self hardMagnifiedBy:ext |
278 | 1571 |
]. |
1572 |
||
3624 | 1573 |
newForm := (self class onDevice:device) |
2827 | 1574 |
width:(width * mX) |
1575 |
height:(height * mY) |
|
1576 |
depth:depth. |
|
3334 | 1577 |
self easyMagnifiedBy:extent into:newForm. |
278 | 1578 |
newForm colorMap:localColorMap. |
1579 |
^ newForm |
|
1580 |
||
1581 |
" |
|
3624 | 1582 |
(ArrowButton upArrowButtonForm:#iris on:Screen current) magnifiedBy:(2 @ 2) |
278 | 1583 |
(Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(2 @ 2) |
1584 |
(Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(0.4 @ 0.4) |
|
1585 |
" |
|
1586 |
! |
|
1587 |
||
569
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1588 |
magnifiedTo:anExtent |
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1589 |
"return a new form magnified to have the size specified by extent. |
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1590 |
This may distort the image if the arguments ratio is not the images ratio. |
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1591 |
See also #magnifiedPreservingRatioTo: and #magnifiedBy:" |
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1592 |
|
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1593 |
^ self magnifiedBy:(anExtent / self extent) |
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1594 |
|
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1595 |
"Created: 18.4.1996 / 16:17:52 / cg" |
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1596 |
! |
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1597 |
|
278 | 1598 |
magnifyBy:scale |
1599 |
"obsolete: has been renamed to magnifiedBy: for ST-80 compatibility |
|
1600 |
and name consistency ..." |
|
1601 |
||
1602 |
self obsoleteMethodWarning. |
|
1603 |
^ self magnifiedBy:scale |
|
0 | 1604 |
! ! |
1605 |
||
1606 |
!Form methodsFor:'initialization'! |
|
1607 |
||
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1608 |
createGC |
1452 | 1609 |
"physically create a device GC. |
1610 |
Since we do not need a gc-object for the drawable until something is |
|
1611 |
really drawn, none is created up to the first draw. |
|
1612 |
This method is sent, when the first drawing happens. |
|
1613 |
Redefined here to create a bitmap GC (some devices (i.e. windows) require |
|
1614 |
different GC's for different canvases." |
|
1615 |
||
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1616 |
gcId := device gcForBitmap:drawableId. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1617 |
Lobby registerChange:self. |
1452 | 1618 |
|
1619 |
"Modified: 19.3.1997 / 11:08:49 / cg" |
|
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1620 |
! |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1621 |
|
0 | 1622 |
initGC |
1623 |
"stop server from sending exposure events for Forms - |
|
1624 |
(will fill up stream-queue on some stupid (i.e. sco) systems" |
|
1625 |
||
951 | 1626 |
"/ depth-1 forms draw differently ... |
1627 |
||
1628 |
depth == 1 ifTrue:[ |
|
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1629 |
foreground isNil ifTrue:[ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1630 |
foreground := paint := Color colorId:1. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1631 |
]. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1632 |
background isNil ifTrue:[ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1633 |
background := bgPaint := Color colorId:0 |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1634 |
] |
951 | 1635 |
]. |
126 | 1636 |
super initGC. |
0 | 1637 |
self setGraphicsExposures:false |
836
d6eb406b1c04
dither bitmaps moved to Color
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
1638 |
|
951 | 1639 |
"Modified: 17.7.1996 / 13:21:24 / cg" |
0 | 1640 |
! |
1641 |
||
278 | 1642 |
initialize |
951 | 1643 |
foreground := paint := Color colorId:1. |
1644 |
background := bgPaint := Color colorId:0. |
|
1645 |
||
3068
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1646 |
"/ must allow for device-less forms to be created |
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1647 |
true "device isNil" ifTrue:[ |
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1648 |
realized := false. |
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1649 |
width := 0. |
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1650 |
height := 0. |
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1651 |
function := #copy. |
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1652 |
lineWidth := 1. |
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1653 |
lineStyle := #solid. |
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1654 |
joinStyle := #miter. |
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1655 |
capStyle := #butt. |
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1656 |
font := DefaultFont. |
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1657 |
] ifFalse:[ |
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1658 |
super initialize. |
7f4b0dd1f738
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3067
diff
changeset
|
1659 |
]. |
278 | 1660 |
depth := 1. |
836
d6eb406b1c04
dither bitmaps moved to Color
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
1661 |
|
951 | 1662 |
"/ foreground isNil ifTrue:[ |
1663 |
"/ foreground := Color colorId:1. |
|
1664 |
"/ ]. |
|
1665 |
"/ paint isNil ifTrue:[ |
|
1666 |
"/ paint := foreground. |
|
1667 |
"/ ]. |
|
1668 |
"/ background isNil ifTrue:[ |
|
1669 |
"/ background := Color colorId:0 |
|
1670 |
"/ ]. |
|
1671 |
"/ bgPaint isNil ifTrue:[ |
|
1672 |
"/ bgPaint := background |
|
1673 |
"/ ] |
|
1674 |
||
1675 |
"Modified: 17.7.1996 / 13:02:01 / cg" |
|
278 | 1676 |
! |
1677 |
||
0 | 1678 |
recreate |
3300 | 1679 |
"reconstruct the form after a snapin or a migration" |
0 | 1680 |
|
2473 | 1681 |
device isNil ifTrue:[^ self]. |
1682 |
||
0 | 1683 |
data notNil ifTrue:[ |
2473 | 1684 |
" |
1685 |
create one from data |
|
1686 |
" |
|
1687 |
(depth == 1 or:[depth == device depth]) ifTrue:[ |
|
1688 |
drawableId := device createBitmapFromArray:data width:width height:height. |
|
1689 |
Lobby registerChange:self. |
|
1690 |
drawableId notNil ifTrue:[ |
|
1691 |
^ self |
|
1692 |
] |
|
1693 |
]. |
|
1694 |
'FORM: cannot recreate form' errorPrintCR. |
|
0 | 1695 |
]. |
1696 |
fileName notNil ifTrue:[ |
|
2473 | 1697 |
" |
1698 |
create one from a file (mhmh - this seems X-specific and will vanish) |
|
1699 |
" |
|
1700 |
self readFromFile:fileName. |
|
871
c078c33c51ac
recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1701 |
|
c078c33c51ac
recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1702 |
"/ drawableId := device createBitmapFromFile:fileName for:self. |
c078c33c51ac
recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1703 |
"/ Lobby registerChange:self. |
2473 | 1704 |
drawableId notNil ifTrue:[ |
1705 |
^ self |
|
1706 |
]. |
|
1707 |
'FORM: cannot recreate file form: ' errorPrint. fileName errorPrintCR. |
|
0 | 1708 |
]. |
871
c078c33c51ac
recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1709 |
|
c078c33c51ac
recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1710 |
^ self. |
c078c33c51ac
recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1711 |
|
3474 | 1712 |
"/ " |
1713 |
"/ create an empty one |
|
1714 |
"/ " |
|
1715 |
"/ depth == 1 ifTrue:[ |
|
1716 |
"/ drawableId := device createBitmapWidth:width height:height |
|
1717 |
"/ ] ifFalse:[ |
|
1718 |
"/ drawableId := device createPixmapWidth:width height:height depth:device depth |
|
1719 |
"/ ]. |
|
1720 |
"/ Lobby registerChange:self |
|
871
c078c33c51ac
recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1721 |
|
c078c33c51ac
recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1722 |
"Modified: 15.6.1996 / 16:18:12 / cg" |
4217 | 1723 |
! |
1724 |
||
1725 |
releaseFromDevice |
|
1726 |
"flush device data. |
|
1727 |
The sender has to take care that the Form has been |
|
1728 |
unregistered from (Finalization-)Lobby" |
|
1729 |
||
1730 |
device := drawableId := gcId := nil. |
|
2 | 1731 |
! ! |
1732 |
||
1733 |
||
278 | 1734 |
!Form methodsFor:'printing & storing'! |
107 | 1735 |
|
278 | 1736 |
storeOn:aStream |
588 | 1737 |
"append an ascii representation of the receiver to aStream, |
1738 |
from which a copy of the receiver can be reconstructed" |
|
1739 |
||
278 | 1740 |
aStream nextPutAll:'(Form width:'. |
1741 |
width storeOn:aStream. |
|
1742 |
aStream nextPutAll:' height:'. |
|
1743 |
height storeOn:aStream. |
|
1744 |
aStream nextPutAll:' fromArray:('. |
|
1745 |
self bits storeOn:aStream. |
|
1746 |
aStream nextPutAll:'))' |
|
588 | 1747 |
|
1748 |
"Modified: 23.4.1996 / 10:21:10 / cg" |
|
107 | 1749 |
! ! |
1750 |
||
0 | 1751 |
!Form methodsFor:'private'! |
1752 |
||
412
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1753 |
beImmediateForm |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1754 |
"read the pixels from the device into a local data array. |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1755 |
This makes certain that a fileName form is independent of |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1756 |
its fileName. |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1757 |
To make the image smaller (i.e. not keep all those bitmaps), |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1758 |
this is NOT done by default." |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1759 |
|
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1760 |
data isNil ifTrue:[ |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1761 |
data := self bits. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1762 |
data notNil ifTrue:[ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1763 |
fileName := nil |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1764 |
] |
412
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1765 |
] |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1766 |
|
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1767 |
" |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1768 |
Form allInstances:[:f | |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1769 |
f beImmediateForm |
412
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1770 |
] |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1771 |
" |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1772 |
|
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1773 |
"Created: 7.2.1996 / 16:04:18 / cg" |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1774 |
! |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1775 |
|
870
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1776 |
flushDeviceHandles |
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1777 |
"flush device handles (sent after a restart)" |
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1778 |
|
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1779 |
drawableId := nil. |
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1780 |
gcId := nil. |
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1781 |
|
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1782 |
"Created: 15.6.1996 / 15:44:28 / cg" |
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1783 |
! |
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1784 |
|
54 | 1785 |
getBits |
1786 |
"if the receiver was not created from a file, or |
|
1787 |
an array (i.e. it was drawn), read the pixels from the |
|
1788 |
device into a local data array. This has to be done before |
|
1789 |
an image is saved, or the receiver is storedBinary, since |
|
1790 |
the information present in the device is lost after restart/reload" |
|
1791 |
||
1792 |
(data isNil and:[fileName isNil]) ifTrue:[ |
|
78 | 1793 |
data := self bits |
54 | 1794 |
] |
1795 |
! |
|
1796 |
||
412
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1797 |
readFromFile:fn |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1798 |
"read a monochrome form from a file (in xbm-format). |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1799 |
The fileName argument, fn should be a relative pathname |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1800 |
such as bitmaps/foo.xbm and the corresponding file |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1801 |
will be searched in the standard places (i.e. along the SEARCHPATH). |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1802 |
Notice, when saving an image, only that fileName is kept with the |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1803 |
form, and the file is reloaded at image startup time. |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1804 |
You should therefore make certain, that the file is present at image |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1805 |
reload time. (this is done to make the image smaller ...) |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1806 |
If you dont like that behavior (or your application should be able to |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1807 |
restart fully standAlone), send #beImmediateForm to all instances of |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1808 |
Form - this will set the data instance variable to a ByteArray containing |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1809 |
the actual bits and will therefore no longer depend on the file being present. |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1810 |
" |
278 | 1811 |
|
3431 | 1812 |
<resource:#obsolete> |
1813 |
||
278 | 1814 |
|pathName| |
1815 |
||
3067
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1816 |
"/ this method is a historic leftover; it uses |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1817 |
"/ the X-libs bitmap file reading function, which is not |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1818 |
"/ available with other windowing systems ... |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1819 |
self obsoleteMethodWarning:'use Image fromFile:'. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1820 |
|
412
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1821 |
pathName := self class findBitmapFile:fn. |
278 | 1822 |
pathName notNil ifTrue:[ |
3067
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1823 |
drawableId := device createBitmapFromFile:pathName for:self. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1824 |
drawableId isNil ifTrue:[^ nil]. |
412
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1825 |
|
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1826 |
"/ fileName := pathName. "/ keep the actual name (wrong) |
3067
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1827 |
fileName := fn. "/ keep the relative name (better - SEARCHPATH may be different at restart) |
278 | 1828 |
|
3067
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1829 |
offset := 0@0. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1830 |
realized := true. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1831 |
BlackAndWhiteColorMap isNil ifTrue:[ |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1832 |
BlackAndWhiteColorMap := Array with:(Color white) with:(Color black) |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1833 |
]. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1834 |
localColorMap := BlackAndWhiteColorMap. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1835 |
Lobby registerChange:self. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1836 |
^ self |
278 | 1837 |
]. |
1838 |
^ nil |
|
412
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1839 |
|
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1840 |
"Modified: 7.2.1996 / 16:04:25 / cg" |
278 | 1841 |
! |
1842 |
||
1843 |
readFromFile:filename resolution:dpi |
|
1844 |
"read a monochrome form from a file, which is assumed to have data for a dpi-resolution; |
|
412
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1845 |
if the actual resolution of the device differs, magnify the form. |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1846 |
Read the comment in #readFromFile: on what happenes if the file is no longer present |
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1847 |
after an image reload." |
278 | 1848 |
|
4217 | 1849 |
<resource:#obsolete> |
1850 |
||
278 | 1851 |
|dpiH mag dev| |
1852 |
||
1853 |
(self readFromFile:filename) isNil ifTrue:[^ nil]. |
|
1854 |
||
1855 |
"if the device is within +- 50% of dpi, no magnify is needed" |
|
1856 |
dev := device. |
|
1857 |
dev isNil ifTrue:[ |
|
3067
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1858 |
"should not happen ..." |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1859 |
dev := Screen current |
278 | 1860 |
]. |
3067
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1861 |
dpiH := dev isNil ifTrue:[90] ifFalse:[dev horizontalPixelPerInch]. |
278 | 1862 |
((dpi >= (dpiH * 0.75)) and:[dpi <= (dpiH * 1.5)]) ifTrue:[^ self]. |
1863 |
mag := (dpiH / dpi) rounded. |
|
1864 |
mag == 0 ifTrue:[ |
|
3067
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1865 |
^ self |
278 | 1866 |
]. |
1867 |
^ self magnifiedBy:(mag @ mag) |
|
1868 |
||
1869 |
"Form fromFile:'SBrowser.icn' resolution:50" |
|
412
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1870 |
|
766ba454c23d
keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents:
398
diff
changeset
|
1871 |
"Modified: 7.2.1996 / 16:03:45 / cg" |
278 | 1872 |
! |
1873 |
||
1058 | 1874 |
restored |
1875 |
"flush device data, when restored (sent after a binaryLoad)" |
|
1876 |
||
1877 |
self release |
|
1878 |
||
1879 |
"Modified: 16.9.1996 / 21:08:57 / cg" |
|
278 | 1880 |
! |
1881 |
||
0 | 1882 |
width:w height:h |
54 | 1883 |
"actual create of a monochrome form" |
0 | 1884 |
|
1885 |
((w == 0) or:[h == 0]) ifTrue:[ |
|
3067
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1886 |
self error:'invalid form extent'. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1887 |
^ nil |
0 | 1888 |
]. |
1889 |
width := w. |
|
1890 |
height := h. |
|
54 | 1891 |
depth := 1. |
0 | 1892 |
offset := 0@0. |
1893 |
BlackAndWhiteColorMap isNil ifTrue:[ |
|
3067
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1894 |
BlackAndWhiteColorMap := Array with:(Color white) with:(Color black) |
0 | 1895 |
]. |
1896 |
localColorMap := BlackAndWhiteColorMap. |
|
3067
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1897 |
|
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1898 |
device notNil ifTrue:[ |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1899 |
drawableId := device createBitmapWidth:w height:h. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1900 |
"/ drawableId isNil ifTrue:[^ nil]. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1901 |
realized := true. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1902 |
Lobby registerChange:self. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1903 |
]. |
0 | 1904 |
! |
1905 |
||
1906 |
width:w height:h depth:d |
|
54 | 1907 |
"actual create of an arbitrary deep form (but, must be supported by device)" |
0 | 1908 |
|
1909 |
width := w. |
|
1910 |
height := h. |
|
1911 |
offset := 0@0. |
|
1912 |
depth := d. |
|
3067
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1913 |
device notNil ifTrue:[ |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1914 |
drawableId := device createPixmapWidth:w height:h depth:d. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1915 |
"/ drawableId isNil ifTrue:[^ nil]. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1916 |
realized := true. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1917 |
Lobby registerChange:self. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1918 |
]. |
0 | 1919 |
! |
1920 |
||
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1921 |
width:wIn height:hIn fromArray:anArray |
54 | 1922 |
"actual create of a monochrome form from array. |
0 | 1923 |
This method is somewhat more complicated as it should be due to |
1924 |
supporting both byte-wise (ST/X-type) and short-word-wise (ST-80-type) |
|
1925 |
Arrays; in the later case, the shorts are first converted to bytes in |
|
1926 |
a ByteArray, then passed to the device." |
|
1927 |
||
134 | 1928 |
|bytes bits |
1929 |
srcPerRow "{ Class: SmallInteger }" |
|
1930 |
dstPerRow "{ Class: SmallInteger }" |
|
1931 |
srcStart "{ Class: SmallInteger }" |
|
1932 |
srcIndex "{ Class: SmallInteger }" |
|
1933 |
dstIndex "{ Class: SmallInteger }" |
|
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1934 |
hi "{ Class: SmallInteger }" |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1935 |
w "{ Class: SmallInteger }" |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1936 |
h "{ Class: SmallInteger }" |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1937 |
sz "{ Class: SmallInteger }" | |
0 | 1938 |
|
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1939 |
w := wIn. |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1940 |
h := hIn. |
0 | 1941 |
bytes := anArray. |
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1942 |
sz := anArray size. |
0 | 1943 |
|
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1944 |
sz ~~ (((w + 7) // 8) * h) ifTrue:[ |
3020 | 1945 |
"/ not bytes ... |
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1946 |
sz == (((w + 15) // 16) * h) ifTrue:[ |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1947 |
"I want the bytes but got shorts (ST-80)" |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1948 |
bytes := ByteArray uninitializedNew:(((w + 7) // 8) * h). |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1949 |
srcPerRow := (w + 15) // 16. |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1950 |
dstPerRow := (w + 7) // 8. |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1951 |
srcStart := 1. |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1952 |
dstIndex := 1. |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1953 |
|
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1954 |
1 to:h do:[:hi | |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1955 |
srcIndex := srcStart. |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1956 |
bits := anArray at:srcIndex. |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1957 |
1 to:dstPerRow do:[:di | |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1958 |
di odd ifTrue:[ |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1959 |
bits := anArray at:srcIndex. |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1960 |
bytes at:dstIndex put:(bits bitShift:-8) |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1961 |
] ifFalse:[ |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1962 |
bytes at:dstIndex put:(bits bitAnd:16rFF). |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1963 |
srcIndex := srcIndex + 1 |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1964 |
]. |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1965 |
dstIndex := dstIndex + 1 |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1966 |
]. |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1967 |
srcStart := srcStart + srcPerRow |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1968 |
] |
3020 | 1969 |
] ifFalse:[ |
1970 |
sz == (((w + 31) // 32) * h) ifTrue:[ |
|
1971 |
"I want the bytes but got longs (Squeak)" |
|
1972 |
||
1973 |
bytes := ByteArray uninitializedNew:(((w + 7) // 8) * h). |
|
1974 |
srcPerRow := (w + 31) // 32. |
|
1975 |
dstPerRow := (w + 7) // 8. |
|
1976 |
srcStart := 1. |
|
1977 |
dstIndex := 1. |
|
1978 |
||
1979 |
1 to:h do:[:hi | |
|
1980 |
|ss| |
|
1981 |
||
1982 |
srcIndex := srcStart. |
|
1983 |
bits := anArray at:srcIndex. |
|
1984 |
ss := 0. |
|
1985 |
1 to:dstPerRow do:[:di | |
|
3025 | 1986 |
ss == 0 ifTrue:[ |
1987 |
bits := anArray at:srcIndex. |
|
1988 |
]. |
|
3020 | 1989 |
bytes at:dstIndex put:((bits bitShift:-24) bitAnd:16rFF). |
1990 |
bits := bits bitShift:8. |
|
1991 |
ss := ss + 1. |
|
1992 |
ss == 4 ifTrue:[ |
|
1993 |
srcIndex := srcIndex + 1. |
|
1994 |
ss := 0. |
|
1995 |
]. |
|
1996 |
dstIndex := dstIndex + 1 |
|
1997 |
]. |
|
1998 |
srcStart := srcStart + srcPerRow |
|
1999 |
] |
|
2000 |
] |
|
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
2001 |
] |
0 | 2002 |
]. |
2003 |
width := w. |
|
2004 |
height := h. |
|
54 | 2005 |
depth := 1. |
0 | 2006 |
offset := 0@0. |
2007 |
data := bytes. |
|
2008 |
BlackAndWhiteColorMap isNil ifTrue:[ |
|
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
2009 |
BlackAndWhiteColorMap := Array with:(Color white) with:(Color black) |
0 | 2010 |
]. |
2011 |
localColorMap := BlackAndWhiteColorMap. |
|
3067
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
2012 |
|
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
2013 |
device notNil ifTrue:[ |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
2014 |
drawableId := device createBitmapFromArray:bytes width:w height:h. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
2015 |
"/ drawableId isNil ifTrue:[^ nil]. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
2016 |
realized := true. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
2017 |
Lobby registerChange:self. |
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
2018 |
]. |
0 | 2019 |
! |
2020 |
||
2021 |
width:w height:h offset:offs fromArray:anArray |
|
54 | 2022 |
"actual create of a monochrome form from array" |
0 | 2023 |
|
2024 |
self width:w height:h fromArray:anArray. |
|
2025 |
offset := offs |
|
2026 |
! ! |
|
2027 |
||
3177 | 2028 |
!Form methodsFor:'queries'! |
99 | 2029 |
|
3812 | 2030 |
ascentOn:aGC |
2031 |
"displayOn: does not draw above baseline" |
|
2032 |
||
2033 |
^ 0 |
|
2034 |
! |
|
2035 |
||
680
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
2036 |
bounds |
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
2037 |
"return my bounds (added to make forms usable as VisualComponents)" |
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
2038 |
|
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
2039 |
^ Rectangle left:0 top:0 width:width height:height |
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
2040 |
|
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
2041 |
"Modified: 13.5.1996 / 10:26:13 / cg" |
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
2042 |
! |
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
2043 |
|
910
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
2044 |
colorFromValue:pixel |
1200 | 2045 |
"given a pixelValue, return the corresponding color. |
2046 |
For compatibility with Images" |
|
2047 |
||
910
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
2048 |
localColorMap notNil ifTrue:[ |
1200 | 2049 |
^ localColorMap at:(pixel + 1) |
910
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
2050 |
]. |
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
2051 |
depth == 1 ifTrue:[ |
1200 | 2052 |
pixel == 0 ifTrue:[^ White]. |
910
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
2053 |
]. |
951 | 2054 |
^ Black |
910
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
2055 |
|
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
2056 |
"Created: 28.6.1996 / 16:10:13 / cg" |
1200 | 2057 |
"Modified: 13.1.1997 / 23:06:25 / cg" |
910
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
2058 |
! |
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
2059 |
|
925 | 2060 |
hasBits |
2061 |
"return true, if the receiver has its pixel data available. |
|
2062 |
For forms, which were created from data, this is always true. |
|
2063 |
For forms, which were created as off-screen device forms on some |
|
2064 |
device, this is always false." |
|
2065 |
||
2066 |
^ data notNil |
|
2067 |
||
2068 |
"Created: 5.7.1996 / 16:21:20 / cg" |
|
2069 |
! |
|
2070 |
||
673 | 2071 |
heightOn:aGC |
674 | 2072 |
"return my height, if displayed on aGC; |
2073 |
since my height is independent of the device (the number of pixels), |
|
2074 |
return the pixel-height" |
|
2075 |
||
680
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
2076 |
^ height |
673 | 2077 |
|
2078 |
"Created: 12.5.1996 / 21:35:33 / cg" |
|
680
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
2079 |
"Modified: 13.5.1996 / 10:26:09 / cg" |
673 | 2080 |
! |
2081 |
||
3700
9b40f1e55270
dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents:
3655
diff
changeset
|
2082 |
isDithered |
9b40f1e55270
dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents:
3655
diff
changeset
|
2083 |
"for compatibility with color protocol" |
9b40f1e55270
dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents:
3655
diff
changeset
|
2084 |
|
9b40f1e55270
dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents:
3655
diff
changeset
|
2085 |
^ false |
9b40f1e55270
dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents:
3655
diff
changeset
|
2086 |
! |
9b40f1e55270
dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents:
3655
diff
changeset
|
2087 |
|
99 | 2088 |
isForm |
2089 |
"return true, if the receiver is some kind of form; |
|
2090 |
true is returned here - the method is redefined from Object." |
|
2091 |
||
2092 |
^ true |
|
2093 |
! |
|
2094 |
||
2095 |
isImageOrForm |
|
2096 |
"return true, if the receiver is some kind of image or form; |
|
2097 |
true is returned here - the method is redefined from Object." |
|
2098 |
||
2099 |
^ true |
|
673 | 2100 |
! |
2101 |
||
2102 |
widthOn:aGC |
|
674 | 2103 |
"return my width, if displayed on aGC; |
2104 |
since my width is independent of the device (the number of pixels), |
|
2105 |
return the pixel-width" |
|
2106 |
||
680
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
2107 |
^ width |
673 | 2108 |
|
2109 |
"Created: 12.5.1996 / 21:35:29 / cg" |
|
680
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
2110 |
"Modified: 13.5.1996 / 10:26:05 / cg" |
99 | 2111 |
! ! |
2112 |
||
1907
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2113 |
!Form::DeviceFormHandle class methodsFor:'documentation'! |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2114 |
|
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2115 |
documentation |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2116 |
" |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2117 |
This is used as a finalization handle for forms - in previous systems, |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2118 |
a shallowCopy of a form was responsible to destroy the underlying |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2119 |
devices bitmap. To make the memory requirements smaller and to speed up |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2120 |
bitmap creation a bit, this lightweight class is used now, which only |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2121 |
keeps the device handle for finalization. |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2122 |
|
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2123 |
[see also:] |
4487 | 2124 |
DeviceHandle Form |
1907
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2125 |
|
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2126 |
[author:] |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2127 |
Claus Gittinger |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2128 |
|
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2129 |
" |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2130 |
! ! |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2131 |
|
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2132 |
!Form::DeviceFormHandle methodsFor:'finalization'! |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2133 |
|
3611
8b4384c9e660
Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents:
3512
diff
changeset
|
2134 |
finalize |
1907
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2135 |
"the Form for which I am a handle has been collected - tell it to the x-server" |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2136 |
|
2074 | 2137 |
|id| |
2138 |
||
1907
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2139 |
drawableId notNil ifTrue:[ |
3611
8b4384c9e660
Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents:
3512
diff
changeset
|
2140 |
(id := gcId) notNil ifTrue:[ |
8b4384c9e660
Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents:
3512
diff
changeset
|
2141 |
gcId := nil. |
8b4384c9e660
Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents:
3512
diff
changeset
|
2142 |
device destroyGC:id. |
8b4384c9e660
Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents:
3512
diff
changeset
|
2143 |
]. |
8b4384c9e660
Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents:
3512
diff
changeset
|
2144 |
id := drawableId. |
8b4384c9e660
Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents:
3512
diff
changeset
|
2145 |
drawableId := nil. |
8b4384c9e660
Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents:
3512
diff
changeset
|
2146 |
device destroyPixmap:id. |
1907
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2147 |
] |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2148 |
|
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2149 |
"Created: 25.9.1997 / 10:03:05 / stefan" |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2150 |
! ! |
61fdff318175
Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents:
1889
diff
changeset
|
2151 |
|
4173
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2152 |
!Form::ImageForm class methodsFor:'documentation'! |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2153 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2154 |
documentation |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2155 |
" |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2156 |
ImageForm is used for Forms, that have been created from an image and do not |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2157 |
hold the image bits. |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2158 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2159 |
It does not fetch the image bits when doing a snapshot. |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2160 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2161 |
[author:] |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2162 |
Stefan Vogel (stefan@zwerg) |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2163 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2164 |
[instance variables:] |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2165 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2166 |
[class variables:] |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2167 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2168 |
[see also:] |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2169 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2170 |
" |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2171 |
! ! |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2172 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2173 |
!Form::ImageForm methodsFor:'private'! |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2174 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2175 |
getBits |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2176 |
"do nothing. The image, that created the ImageForm, has the bits" |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2177 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2178 |
^ self |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2179 |
! |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2180 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2181 |
recreate |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2182 |
"nothing to do here. The image recreates the form if needed" |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2183 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2184 |
^ self |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2185 |
! ! |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
2186 |
|
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
2187 |
!Form class methodsFor:'documentation'! |
134 | 2188 |
|
278 | 2189 |
version |
4768 | 2190 |
^ '$Header: /cvs/stx/stx/libview/Form.st,v 1.138 2007-05-29 17:32:37 cg Exp $' |
0 | 2191 |
! ! |
3811 | 2192 |
|
278 | 2193 |
Form initialize! |