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