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