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