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