author | Claus Gittinger <cg@exept.de> |
Thu, 15 Aug 2019 19:50:54 +0200 | |
changeset 8776 | 7b28d7a6f3cb |
parent 8686 | 4c625772e184 |
child 8796 | 502cb6bba147 |
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 |
|
8300 | 58 |
by all devices, whereas Image contains all the required code to convert as |
8138 | 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 |
||
8594 | 845 |
self displayOn:aGC x:x y:y rule:#copy |
672 | 846 |
|
8594 | 847 |
"Created: / 12-05-1996 / 20:15:05 / cg" |
848 |
"Modified: / 23-11-2018 / 14:53:26 / Stefan Vogel" |
|
672 | 849 |
! |
850 |
||
851 |
displayOn:aGC x:x y:y rule:rule |
|
852 |
"draw in aGC. |
|
853 |
Smalltalk-80 (2.x) compatibility" |
|
854 |
||
278 | 855 |
|f| |
856 |
||
857 |
f := aGC function. |
|
858 |
aGC function:rule. |
|
672 | 859 |
aGC displayOpaqueForm:self x:x y:y. |
278 | 860 |
aGC function:f. |
861 |
||
672 | 862 |
"Created: 12.5.1996 / 20:15:26 / cg" |
278 | 863 |
! |
864 |
||
1325 | 865 |
isOpen |
866 |
^ true |
|
867 |
||
868 |
"Created: 10.2.1997 / 12:43:49 / cg" |
|
869 |
! |
|
870 |
||
278 | 871 |
offset |
872 |
"set the offset. |
|
873 |
Smalltalk-80 compatibility" |
|
874 |
||
875 |
^ offset |
|
876 |
! |
|
877 |
||
878 |
offset:org |
|
879 |
"set the offset. |
|
880 |
Smalltalk-80 compatibility" |
|
881 |
||
882 |
offset := org |
|
1325 | 883 |
! |
884 |
||
885 |
preferredBounds |
|
886 |
^ self bounds |
|
887 |
||
888 |
"Created: 10.2.1997 / 12:43:00 / cg" |
|
278 | 889 |
! ! |
890 |
||
3880 | 891 |
!Form methodsFor:'Compatibility-Squeak'! |
3020 | 892 |
|
893 |
colormapIfNeededForDepth:destDepth |
|
894 |
||
895 |
^nil |
|
3025 | 896 |
! |
897 |
||
8319 | 898 |
magnify:aRectangle by:scale smoothing:smoothBoolean |
899 |
"Squeak compatibility: |
|
900 |
a little inefficient hack: convert to image, then magnify, |
|
901 |
then convert back" |
|
902 |
||
903 |
^ ((Image fromSubForm:aRectangle in:self) |
|
904 |
magnifiedBy:scale smooth:smoothBoolean) asFormOn:device. |
|
8295 | 905 |
! |
906 |
||
907 |
pixelAt:aPoint |
|
908 |
^ self valueAt:aPoint |
|
909 |
! |
|
910 |
||
911 |
pixelAt:aPoint put:aPixelValue |
|
912 |
^ self valueAt:aPoint put:aPixelValue |
|
3020 | 913 |
! ! |
914 |
||
278 | 915 |
!Form methodsFor:'accessing'! |
916 |
||
917 |
bits |
|
918 |
"return a ByteArray filled with my bits - |
|
919 |
for depth 8 forms, 1 pixel/byte is filled; |
|
920 |
for depth 1 forms, 8 pixels/byte are filled |
|
921 |
for depth 4 forms, 2 pixels/byte are filled. |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
922 |
Padding is done row-wise to the next BYTE-boundary |
1645 | 923 |
If multiple pixels are contained in a single byte, |
924 |
left bits are in the most significant bit positions. |
|
278 | 925 |
(i.e. for width==13 and depth==1 it will return 2 bytes per scanline)" |
926 |
||
927 |
|bytesPerLine "{ Class: SmallInteger }" |
|
928 |
bytesPerLineIn "{ Class: SmallInteger }" |
|
929 |
inData tmpData info |
|
930 |
srcIndex "{ Class: SmallInteger }" |
|
931 |
dstIndex "{ Class: SmallInteger }" |
|
2060 | 932 |
buffer spaceBitsPerPixel| |
278 | 933 |
|
934 |
data notNil ifTrue:[ |
|
1458
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
935 |
^ data |
278 | 936 |
]. |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
937 |
self drawableId isNil ifTrue:[ |
1458
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
938 |
^ nil |
278 | 939 |
]. |
940 |
||
2060 | 941 |
spaceBitsPerPixel := depth. |
942 |
(depth > 8) ifTrue:[ |
|
943 |
spaceBitsPerPixel := 16. |
|
944 |
(depth > 16) ifTrue:[ |
|
945 |
spaceBitsPerPixel := 32. |
|
946 |
(depth > 32) ifTrue:[ |
|
947 |
spaceBitsPerPixel := depth. |
|
948 |
] |
|
949 |
] |
|
950 |
]. |
|
951 |
||
952 |
bytesPerLine := (width * spaceBitsPerPixel + 31) // 32 * 4. |
|
278 | 953 |
inData := ByteArray uninitializedNew:(bytesPerLine * height). |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
954 |
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
|
955 |
bytesPerLineIn := (info at:#bytesPerLine). "what I got" |
278 | 956 |
bytesPerLine := (width * depth + 7) // 8. "what I want" |
957 |
(bytesPerLine ~~ bytesPerLineIn) ifTrue:[ |
|
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 |
different padding - have to copy over row-wise |
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 |
tmpData := inData. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
962 |
inData := ByteArray uninitializedNew:(bytesPerLine * height). |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
963 |
srcIndex := 1. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
964 |
dstIndex := 1. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
965 |
1 to:height do:[:hi | |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
966 |
inData replaceFrom:dstIndex to:(dstIndex + bytesPerLine - 1) |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
967 |
with:tmpData startingAt:srcIndex. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
968 |
dstIndex := dstIndex + bytesPerLine. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
969 |
srcIndex := srcIndex + bytesPerLineIn |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
970 |
] |
278 | 971 |
] ifFalse:[ |
1458
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
972 |
" |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
973 |
same padding - copy over all in one chunk |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
974 |
" |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
975 |
(bytesPerLine * height) ~~ inData size ifTrue:[ |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
976 |
tmpData := inData. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
977 |
inData := ByteArray uninitializedNew:(bytesPerLine * height). |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
978 |
inData replaceFrom:1 to:bytesPerLine * height with:tmpData startingAt:1 |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
979 |
] |
278 | 980 |
]. |
1645 | 981 |
|
278 | 982 |
" |
983 |
have to reverse bytes, if not msbFirst ? |
|
984 |
" |
|
915 | 985 |
|
986 |
"/ (info at:#byteOrder) ~~ #msbFirst ifTrue:[ |
|
987 |
"/ buffer := ByteArray new:bytesPerLine. |
|
988 |
"/ dstIndex := 1. |
|
989 |
"/ 1 to:height do:[:hi | |
|
990 |
"/ buffer replaceFrom:1 to:bytesPerLine with:inData startingAt:dstIndex. |
|
991 |
"/ buffer reverse. |
|
992 |
"/ inData replaceFrom:dstIndex to:dstIndex+bytesPerLine-1 with:buffer startingAt:1. |
|
993 |
"/ dstIndex := dstIndex + bytesPerLine |
|
994 |
"/ ] |
|
995 |
"/ ]. |
|
1645 | 996 |
|
997 |
" |
|
998 |
have to reverse bits, if not msbFirst ? |
|
999 |
" |
|
398
2b35bb58a82b
changes for new returned info from getBits
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
1000 |
(info at:#bitOrder) ~~ #msbFirst ifTrue:[ |
1458
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1001 |
buffer := ByteArray new:bytesPerLine. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1002 |
dstIndex := 1. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1003 |
1 to:height do:[:hi | |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1004 |
buffer replaceFrom:1 to:bytesPerLine with:inData startingAt:dstIndex. |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1005 |
buffer expandPixels:8 width:bytesPerLine height:1 into:buffer |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1006 |
mapping:(ImageReader reverseBits). "/ translate only |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1007 |
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
|
1008 |
dstIndex := dstIndex + bytesPerLine |
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1009 |
] |
278 | 1010 |
]. |
1011 |
||
1012 |
^ inData. |
|
1458
612420702141
splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents:
1452
diff
changeset
|
1013 |
|
2060 | 1014 |
"Modified: / 19.2.1998 / 14:47:06 / cg" |
278 | 1015 |
! |
1016 |
||
588 | 1017 |
bits:aByteArray |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1018 |
"set the forms bits; |
588 | 1019 |
for depth-8 forms, 1 pixel/byte is expected; |
1020 |
for depth-1 forms, 8 pixels/byte are expected |
|
1021 |
for depth-4 forms, 2 pixels/byte are expected. |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1022 |
Padding is expected to the next byte-boundary |
588 | 1023 |
(i.e. for width==13 and depth==1 2 bytes per scanline are expected)" |
1024 |
||
1025 |
data := aByteArray |
|
1026 |
||
1027 |
"Modified: 23.4.1996 / 10:06:01 / cg" |
|
278 | 1028 |
! |
1029 |
||
1030 |
bitsPerSample |
|
1031 |
"for compatibility with Image class ..." |
|
1032 |
||
1033 |
^ Array with:depth |
|
1034 |
! |
|
1035 |
||
1036 |
colorMap |
|
7238 | 1037 |
"return the receiver's colormap" |
278 | 1038 |
|
1039 |
^ localColorMap |
|
1040 |
! |
|
1041 |
||
1436 | 1042 |
colorMap:anArrayOrColorMap |
7238 | 1043 |
"set the receiver's colormap" |
278 | 1044 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1045 |
localColorMap := anArrayOrColorMap. |
278 | 1046 |
! |
1047 |
||
1048 |
depth |
|
7238 | 1049 |
"return the receiver's depth" |
278 | 1050 |
|
1051 |
^ depth |
|
1052 |
! |
|
1053 |
||
1054 |
forgetBits |
|
1055 |
"for image, which also keeps the bits - so there is |
|
1056 |
no need to hold them again here" |
|
1057 |
||
1058 |
data := nil |
|
1059 |
! |
|
1060 |
||
897 | 1061 |
mask |
1062 |
"for compatibility with images; forms have no mask/alpha channel" |
|
1063 |
||
1064 |
^ nil |
|
1065 |
||
1066 |
"Created: 21.6.1996 / 12:52:42 / cg" |
|
1067 |
! |
|
1068 |
||
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1069 |
maskedPixelsAre0 |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1070 |
^ maskedPixelsAre0 |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1071 |
! |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1072 |
|
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1073 |
maskedPixelsAre0:something |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1074 |
maskedPixelsAre0 := something. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1075 |
! |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1076 |
|
278 | 1077 |
photometric |
1078 |
"for compatibility with Image class ..." |
|
1079 |
||
1080 |
depth == 1 ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1081 |
localColorMap isNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1082 |
^ #whiteIs0 |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1083 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1084 |
((localColorMap at:1) = Color white) ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1085 |
((localColorMap at:2) = Color black) ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1086 |
^ #whiteIs0 |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1087 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1088 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1089 |
((localColorMap at:1) = Color black) ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1090 |
((localColorMap at:2) = Color white) ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1091 |
^ #blackIs0 |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1092 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1093 |
]. |
6483 | 1094 |
] ifFalse:[depth > 8 ifTrue:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1095 |
^ #rgb |
6483 | 1096 |
]]. |
1097 |
||
278 | 1098 |
^ #palette |
872 | 1099 |
|
1100 |
"Modified: 17.6.1996 / 11:45:16 / cg" |
|
278 | 1101 |
! |
1102 |
||
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1103 |
samplesPerPixel |
278 | 1104 |
"for compatibility with Image class ..." |
1105 |
||
1106 |
^ 1 |
|
1107 |
! |
|
1108 |
||
1109 |
valueAt:aPoint |
|
588 | 1110 |
"return the pixel at aPoint; the coordinates start with 0@0 |
1111 |
in the upper left, increasing to the lower right" |
|
1112 |
||
278 | 1113 |
^ self at:aPoint |
588 | 1114 |
|
1115 |
"Modified: 23.4.1996 / 10:06:55 / cg" |
|
278 | 1116 |
! |
1117 |
||
1118 |
valueAt:aPoint put:value |
|
588 | 1119 |
"set the pixel at aPoint; the coordinates start with 0@0 |
1120 |
in the upper left, increasing to the lower right." |
|
1121 |
||
278 | 1122 |
^ self at:aPoint put:value |
588 | 1123 |
|
1124 |
" |
|
1125 |
|f| |
|
1126 |
||
1127 |
f := Form width:10 height:10 depth:1. |
|
1128 |
f clear. |
|
1129 |
1 to:10 do:[:i | |
|
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1130 |
f valueAt:(i @ i) put:1 |
588 | 1131 |
]. |
1132 |
f inspect |
|
1133 |
" |
|
1134 |
||
1135 |
"Modified: 23.4.1996 / 10:12:48 / cg" |
|
278 | 1136 |
! ! |
1137 |
||
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1138 |
|
278 | 1139 |
!Form methodsFor:'converting'! |
1140 |
||
1141 |
asForm |
|
588 | 1142 |
"convert & return the receiver into a Form instance - nothing to be done here" |
1143 |
||
278 | 1144 |
^ self |
588 | 1145 |
|
1146 |
"Modified: 23.4.1996 / 10:14:11 / cg" |
|
278 | 1147 |
! |
1148 |
||
1149 |
asImage |
|
588 | 1150 |
"convert & return the receiver into an Image instance" |
1151 |
||
278 | 1152 |
^ Image fromForm:self |
588 | 1153 |
|
1154 |
"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
|
1155 |
! |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1156 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1157 |
asImageForm |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1158 |
"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
|
1159 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1160 |
|imageForm| |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1161 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1162 |
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
|
1163 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1164 |
"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
|
1165 |
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
|
1166 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1167 |
gc finalizationLobby |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1168 |
unregister:gc; |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1169 |
registerChange:imageForm graphicsContext. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1170 |
|
4173
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1171 |
^ imageForm. |
278 | 1172 |
! ! |
1173 |
||
8686 | 1174 |
!Form methodsFor:'copying-private'! |
278 | 1175 |
|
1176 |
postCopy |
|
588 | 1177 |
"redefined to copy the colorMap as well" |
1178 |
||
278 | 1179 |
super postCopy. |
1180 |
localColorMap := localColorMap copy. |
|
1181 |
data := data copy |
|
588 | 1182 |
|
1183 |
"Modified: 23.4.1996 / 10:14:46 / cg" |
|
278 | 1184 |
! ! |
1185 |
||
1186 |
!Form methodsFor:'editing'! |
|
1187 |
||
1188 |
show |
|
588 | 1189 |
"open an imageView on the receiver" |
1190 |
||
278 | 1191 |
ImageView openOnImage:self |
1192 |
||
1193 |
" |
|
1194 |
(Form fromFile:'bitmaps/SBrowser.xbm') show |
|
1195 |
" |
|
588 | 1196 |
|
1197 |
"Modified: 23.4.1996 / 10:16:12 / cg" |
|
278 | 1198 |
! ! |
1199 |
||
1200 |
!Form methodsFor:'getting a device form'! |
|
1201 |
||
1202 |
asFormOn:aDevice |
|
588 | 1203 |
"convert & return the receiver into a Form instance |
1204 |
and associate it to a device (i.e. download its bits). |
|
1205 |
Added for protocol compatibility with Image." |
|
1206 |
||
278 | 1207 |
aDevice == device ifTrue:[ |
1889
8e24afd8174e
Send #onDevice instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents:
1745
diff
changeset
|
1208 |
^ self |
278 | 1209 |
]. |
1889
8e24afd8174e
Send #onDevice instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents:
1745
diff
changeset
|
1210 |
^ self onDevice:aDevice |
588 | 1211 |
|
1212 |
"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
|
1213 |
"Modified: 26.8.1997 / 10:29:14 / stefan" |
278 | 1214 |
! |
1215 |
||
1216 |
asMonochromeFormOn:aDevice |
|
588 | 1217 |
"added for protocol compatiblity with Image" |
1218 |
||
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1219 |
depth == 1 ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1220 |
aDevice == device ifTrue:[ |
2191 | 1221 |
^ self |
1222 |
]. |
|
1223 |
^ self onDevice:aDevice |
|
278 | 1224 |
]. |
1225 |
^ nil |
|
588 | 1226 |
|
2191 | 1227 |
"Modified: / 27.7.1998 / 20:04:37 / cg" |
278 | 1228 |
! |
1229 |
||
3104
edc88b280153
added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3068
diff
changeset
|
1230 |
exactOn:aDevice |
3106
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1231 |
"for compatibility with color protocol - here, the same as #onDevice." |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1232 |
|
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1233 |
^ self onDevice:aDevice |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1234 |
|
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1235 |
! |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1236 |
|
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1237 |
exactOrNearestOn:aDevice |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1238 |
"for compatibility with color protocol - here, the same as #onDevice." |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1239 |
|
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1240 |
^ self onDevice:aDevice |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1241 |
|
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1242 |
! |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1243 |
|
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1244 |
nearestOn:aDevice |
d6333a2bd850
more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3104
diff
changeset
|
1245 |
"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
|
1246 |
|
edc88b280153
added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3068
diff
changeset
|
1247 |
^ self onDevice:aDevice |
edc88b280153
added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3068
diff
changeset
|
1248 |
|
edc88b280153
added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3068
diff
changeset
|
1249 |
! |
edc88b280153
added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
3068
diff
changeset
|
1250 |
|
278 | 1251 |
on:aDevice |
588 | 1252 |
"associate the receiver to a device (i.e. download its bits); |
1253 |
return a deviceForm (possibly different from the receiver)." |
|
1254 |
||
1741 | 1255 |
"/ send out a warning: #on: is typically used to create views |
1256 |
"/ operating on a model. |
|
1257 |
"/ Please use #onDevice: to avoid confusion. |
|
1258 |
||
3431 | 1259 |
<resource:#obsolete> |
1260 |
||
1741 | 1261 |
self obsoleteMethodWarning:'use #onDevice:'. |
1262 |
^ self onDevice:aDevice |
|
1263 |
||
1264 |
"Modified: 5.6.1997 / 21:05:34 / cg" |
|
1265 |
! |
|
1266 |
||
1267 |
onDevice:aDevice |
|
1268 |
"associate the receiver to a device (i.e. download its bits); |
|
1269 |
return a deviceForm (possibly different from the receiver)." |
|
1270 |
||
278 | 1271 |
aDevice == device ifTrue:[ |
1436 | 1272 |
^ self |
278 | 1273 |
]. |
2980
409e9547a45c
ignore nil device in #onDevice:
Claus Gittinger <cg@exept.de>
parents:
2964
diff
changeset
|
1274 |
aDevice isNil ifTrue:[^ self]. |
409e9547a45c
ignore nil device in #onDevice:
Claus Gittinger <cg@exept.de>
parents:
2964
diff
changeset
|
1275 |
|
278 | 1276 |
"create a new form ..." |
1277 |
||
1278 |
data notNil ifTrue:[ |
|
2191 | 1279 |
"/ '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
|
1280 |
^ self class width:width height:height fromArray:data onDevice:aDevice |
278 | 1281 |
]. |
7632 | 1282 |
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
|
1283 |
^ (self class width:width height:height onDevice:aDevice) clear |
588 | 1284 |
|
2191 | 1285 |
"Modified: / 27.7.1998 / 20:05:20 / cg" |
278 | 1286 |
! ! |
1287 |
||
1288 |
!Form methodsFor:'image manipulations'! |
|
1289 |
||
3655 | 1290 |
clearMaskedPixels |
1291 |
"Added for protocol compatibility with Image." |
|
1292 |
||
1293 |
^ self |
|
1294 |
! |
|
1295 |
||
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1296 |
clearMaskedPixels:maskForm |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1297 |
"clear any masked pixels. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1298 |
This will allow faster drawing in the future." |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1299 |
|
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1300 |
"black is 0 in mask - masked bits are 0" |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1301 |
gc |
7493 | 1302 |
foreground:Color allColor background:Color noColor; |
1303 |
function:#and; |
|
1304 |
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
|
1305 |
|
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1306 |
maskedPixelsAre0 := true. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1307 |
! |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1308 |
|
278 | 1309 |
darkened |
588 | 1310 |
"return a darkened version of the receiver. |
1311 |
Added for protocol compatibility with Color and Image. |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1312 |
Here, the receiver is returned as a kludge |
588 | 1313 |
- actually should return a darkened image (or Color black ?) .." |
278 | 1314 |
|
8138 | 1315 |
'Form [warning]: ignored lightened request' infoPrintCR. |
278 | 1316 |
^ self |
588 | 1317 |
|
8138 | 1318 |
"Modified: / 31-08-2017 / 11:42:15 / cg" |
278 | 1319 |
! |
1320 |
||
3334 | 1321 |
easyMagnifiedBy:extent into: newForm |
1322 |
"return a new form magnified by extent, aPoint. |
|
1323 |
If non-integral magnify is asked for, pass the work on to 'hardMagnifiedBy:'" |
|
1324 |
||
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1325 |
|mX mY dstX dstY ext |
3334 | 1326 |
factor "{ Class: SmallInteger }" |
1327 |
n "{ Class: SmallInteger }" | |
|
1328 |
||
1329 |
ext := extent asPoint. |
|
1330 |
mX := ext x. |
|
1331 |
mY := ext y. |
|
1332 |
((mX = 1) and:[mY = 1]) ifTrue:[^ self]. |
|
1333 |
||
1334 |
"expand rows" |
|
1335 |
(mY > 1) ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1336 |
dstY := 0. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1337 |
n := height. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1338 |
factor := mY. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1339 |
0 to:(n - 1) do:[:srcY | |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1340 |
1 to:factor do:[:i | |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1341 |
newForm copyFrom:self |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1342 |
x:0 y:srcY |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1343 |
toX:0 y:dstY |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1344 |
width:width height:1. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1345 |
dstY := dstY + 1 |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1346 |
] |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1347 |
] |
3334 | 1348 |
]. |
1349 |
||
1350 |
"expand cols" |
|
1351 |
(mX > 1) ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1352 |
n := width. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1353 |
factor := mX. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1354 |
dstX := (n * factor) - 1. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1355 |
(n - 1) to:0 by:-1 do:[:srcX | |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1356 |
1 to:factor do:[:i | |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1357 |
newForm copyFrom:newForm |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1358 |
x:srcX y:0 |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1359 |
toX:dstX y:0 |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1360 |
width:1 height:(height * mY). |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1361 |
dstX := dstX - 1 |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1362 |
] |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1363 |
] |
3334 | 1364 |
]. |
1365 |
^ newForm |
|
1366 |
||
1367 |
" |
|
1368 |
(ArrowButton upArrowButtonForm:#iris on:Display) magnifiedBy:(2 @ 2) |
|
1369 |
(Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(2 @ 2) |
|
1370 |
(Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(0.4 @ 0.4) |
|
1371 |
" |
|
1372 |
! |
|
1373 |
||
8138 | 1374 |
flip:how |
1375 |
"return a new form flipped horizontally or vertically" |
|
4206 | 1376 |
|
8138 | 1377 |
|dstX dstY newForm | |
278 | 1378 |
|
3624 | 1379 |
newForm := (self class onDevice:device) |
8138 | 1380 |
width:width height:height depth:depth. |
1381 |
how == #horizontal ifTrue:[ |
|
1382 |
dstX := width - 1. |
|
1383 |
0 to:dstX do:[:srcX | |
|
1384 |
newForm copyFrom:self x:srcX y:0 toX:dstX y:0 width:1 height:height. |
|
1385 |
dstX := dstX - 1 |
|
1386 |
]. |
|
1387 |
] ifFalse:[ |
|
1388 |
dstY := height - 1. |
|
1389 |
0 to:dstY do:[:srcY | |
|
1390 |
newForm copyFrom:self x:0 y:srcY toX:0 y:dstY width:width height:1. |
|
1391 |
dstY := dstY - 1 |
|
1392 |
]. |
|
4206 | 1393 |
]. |
1394 |
newForm colorMap:localColorMap. |
|
1395 |
^ newForm |
|
1396 |
||
1397 |
" |
|
1398 |
|testForm| |
|
1399 |
||
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1400 |
testForm _ Form |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1401 |
extent: 8@8 |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1402 |
depth: 1 |
4206 | 1403 |
fromArray: |
1404 |
#( 2r10000000 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1405 |
2r11000000 |
4206 | 1406 |
2r11100000 |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1407 |
2r11110000 |
4206 | 1408 |
2r11111000 |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1409 |
2r11111100 |
4206 | 1410 |
2r11111110 |
1411 |
2r11111111) |
|
1412 |
offset: 0@0. |
|
1413 |
testForm inspect. |
|
8138 | 1414 |
(testForm flip:#vertical) inspect. |
1415 |
(testForm flip:#horizontal) inspect. |
|
1416 |
" |
|
1417 |
||
1418 |
"Created: / 31-08-2017 / 11:38:16 / cg" |
|
1419 |
! |
|
1420 |
||
1421 |
flipHorizontal |
|
1422 |
"return a new form flipped vertically" |
|
1423 |
||
1424 |
^ self flip:#horizontal |
|
1425 |
||
1426 |
" |
|
1427 |
|testForm| |
|
1428 |
||
1429 |
testForm := Form |
|
1430 |
extent: 8@8 |
|
1431 |
depth: 1 |
|
1432 |
fromArray: |
|
1433 |
#( 2r10000000 |
|
1434 |
2r11000000 |
|
1435 |
2r11100000 |
|
1436 |
2r11110000 |
|
1437 |
2r11111000 |
|
1438 |
2r11111100 |
|
1439 |
2r11111110 |
|
1440 |
2r11111111) |
|
1441 |
offset: 0@0. |
|
1442 |
testForm inspect. |
|
4206 | 1443 |
testForm flipVertical inspect. |
1444 |
testForm flipHorizontal inspect. |
|
1445 |
" |
|
8138 | 1446 |
|
1447 |
"Modified: / 31-08-2017 / 11:41:46 / cg" |
|
4206 | 1448 |
! |
1449 |
||
1450 |
flipVertical |
|
1451 |
"return a new form flipped horizontally" |
|
1452 |
||
8138 | 1453 |
^ self flip:#vertical |
4206 | 1454 |
|
1455 |
" |
|
1456 |
|testForm| |
|
1457 |
||
1458 |
testForm _ Form |
|
1459 |
extent: 8@8 |
|
1460 |
depth: 1 |
|
1461 |
fromArray: |
|
1462 |
#( 2r10000000 |
|
1463 |
2r11000000 |
|
1464 |
2r11100000 |
|
1465 |
2r11110000 |
|
1466 |
2r11111000 |
|
1467 |
2r11111100 |
|
1468 |
2r11111110 |
|
1469 |
2r11111111) |
|
1470 |
offset: 0@0. |
|
1471 |
testForm inspect. |
|
1472 |
testForm flipVertical inspect. |
|
1473 |
testForm flipHorizontal inspect. |
|
1474 |
" |
|
8138 | 1475 |
|
1476 |
"Modified: / 31-08-2017 / 11:41:54 / cg" |
|
278 | 1477 |
! |
1478 |
||
1479 |
hardMagnifiedBy:extent |
|
1480 |
"return a new form magnified by extent, aPoint. |
|
1481 |
This method handles non-integral factors." |
|
1482 |
||
1483 |
" |
|
1484 |
since Form will be replaced by Image in the long run, |
|
1485 |
and this operation is slow anyway, use the implementation |
|
1486 |
in Image for this." |
|
1487 |
||
1488 |
^ ((Image fromForm:self) magnifiedBy:extent) asFormOn:device. |
|
1489 |
||
1490 |
" |
|
1491 |
(Form fromFile:'OutputOn.64') magnifiedBy:0.5@0.5 |
|
1492 |
(Form fromFile:'OutputOn.64') magnifiedBy:1.5@1.5 |
|
1493 |
" |
|
1494 |
! |
|
1495 |
||
1496 |
lightened |
|
588 | 1497 |
"return a lightened version of the receiver. |
1498 |
Added for protocol compatibility with Color and Image. |
|
8138 | 1499 |
Here, the receiver is returned unchanged as a kludge |
588 | 1500 |
- actually should return a lightened image (or Color white ?) .." |
278 | 1501 |
|
8138 | 1502 |
'Form [warning]: ignored lightened request' infoPrintCR. |
278 | 1503 |
^ self |
588 | 1504 |
|
8138 | 1505 |
"Modified: / 31-08-2017 / 11:36:32 / cg" |
278 | 1506 |
! |
1507 |
||
1508 |
magnifiedBy:extent |
|
1509 |
"return a new form magnified by extent, aPoint. |
|
1510 |
If non-integral magnify is asked for, pass the work on to 'hardMagnifiedBy:'" |
|
1511 |
||
3624 | 1512 |
|mX mY newForm ext| |
278 | 1513 |
|
1514 |
ext := extent asPoint. |
|
1515 |
mX := ext x. |
|
1516 |
mY := ext y. |
|
1517 |
((mX = 1) and:[mY = 1]) ifTrue:[^ self]. |
|
1518 |
||
1519 |
((mX isMemberOf:SmallInteger) and:[mY isMemberOf:SmallInteger]) ifFalse:[ |
|
2827 | 1520 |
^ self hardMagnifiedBy:ext |
278 | 1521 |
]. |
1522 |
||
3624 | 1523 |
newForm := (self class onDevice:device) |
2827 | 1524 |
width:(width * mX) |
1525 |
height:(height * mY) |
|
1526 |
depth:depth. |
|
3334 | 1527 |
self easyMagnifiedBy:extent into:newForm. |
278 | 1528 |
newForm colorMap:localColorMap. |
1529 |
^ newForm |
|
1530 |
||
1531 |
" |
|
3624 | 1532 |
(ArrowButton upArrowButtonForm:#iris on:Screen current) magnifiedBy:(2 @ 2) |
278 | 1533 |
(Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(2 @ 2) |
1534 |
(Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(0.4 @ 0.4) |
|
1535 |
" |
|
1536 |
! |
|
1537 |
||
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1538 |
magnifiedTo:anExtent |
569
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1539 |
"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
|
1540 |
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
|
1541 |
See also #magnifiedPreservingRatioTo: and #magnifiedBy:" |
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1542 |
|
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1543 |
^ self magnifiedBy:(anExtent / self extent) |
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1544 |
|
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1545 |
"Created: 18.4.1996 / 16:17:52 / cg" |
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1546 |
! |
7dee80bce37b
added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents:
425
diff
changeset
|
1547 |
|
278 | 1548 |
magnifyBy:scale |
5213 | 1549 |
<resource: #obsolete> |
278 | 1550 |
"obsolete: has been renamed to magnifiedBy: for ST-80 compatibility |
1551 |
and name consistency ..." |
|
1552 |
||
1553 |
self obsoleteMethodWarning. |
|
1554 |
^ self magnifiedBy:scale |
|
0 | 1555 |
! ! |
1556 |
||
1557 |
!Form methodsFor:'initialization'! |
|
1558 |
||
1559 |
initGC |
|
8354 | 1560 |
"redefined to setup the drawing colors to paint 1's on 0's |
1561 |
and to stop the server from sending exposure events for Forms - |
|
1562 |
(this would fill up stream-queue on some stupid (i.e. sco) systems" |
|
0 | 1563 |
|
7751 | 1564 |
|gcId| |
1565 |
||
951 | 1566 |
"/ depth-1 forms draw differently ... |
1567 |
depth == 1 ifTrue:[ |
|
7751 | 1568 |
|fg bg| |
8354 | 1569 |
"/ gc foreground isNil ifTrue:[ |
7751 | 1570 |
fg := Color colorId:1. |
8354 | 1571 |
"/ ]. |
1572 |
"/ gc background isNil ifTrue:[ |
|
1573 |
bg := Color colorId:0. |
|
1574 |
"/ ]. |
|
7751 | 1575 |
"nil colors will not be set" |
8354 | 1576 |
gc setPaint:fg on:bg. |
951 | 1577 |
]. |
7751 | 1578 |
gcId := super initGC. |
8354 | 1579 |
|
1580 |
"/ no exposures... |
|
1581 |
gc setGraphicsExposures:false. |
|
7751 | 1582 |
^ gcId. |
836
d6eb406b1c04
dither bitmaps moved to Color
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
1583 |
|
951 | 1584 |
"Modified: 17.7.1996 / 13:21:24 / cg" |
0 | 1585 |
! |
1586 |
||
278 | 1587 |
initialize |
1588 |
depth := 1. |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1589 |
maskedPixelsAre0 := false. |
6232 | 1590 |
super initialize. |
278 | 1591 |
! |
1592 |
||
0 | 1593 |
recreate |
3300 | 1594 |
"reconstruct the form after a snapin or a migration" |
0 | 1595 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1596 |
device isNil ifTrue:[^ self]. |
2473 | 1597 |
|
0 | 1598 |
data notNil ifTrue:[ |
2473 | 1599 |
" |
1600 |
create one from data |
|
1601 |
" |
|
1602 |
(depth == 1 or:[depth == device depth]) ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1603 |
gc createBitmapFromArray:data width:width height:height. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1604 |
gc drawableId notNil ifTrue:[ |
2473 | 1605 |
^ self |
1606 |
] |
|
1607 |
]. |
|
1608 |
'FORM: cannot recreate form' errorPrintCR. |
|
0 | 1609 |
]. |
871
c078c33c51ac
recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1610 |
|
c078c33c51ac
recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1611 |
^ self. |
c078c33c51ac
recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1612 |
|
3474 | 1613 |
"/ " |
1614 |
"/ create an empty one |
|
1615 |
"/ " |
|
1616 |
"/ depth == 1 ifTrue:[ |
|
1617 |
"/ drawableId := device createBitmapWidth:width height:height |
|
1618 |
"/ ] ifFalse:[ |
|
1619 |
"/ drawableId := device createPixmapWidth:width height:height depth:device depth |
|
1620 |
"/ ]. |
|
871
c078c33c51ac
recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1621 |
|
c078c33c51ac
recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1622 |
"Modified: 15.6.1996 / 16:18:12 / cg" |
4217 | 1623 |
! |
1624 |
||
1625 |
releaseFromDevice |
|
1626 |
"flush device data. |
|
1627 |
The sender has to take care that the Form has been |
|
1628 |
unregistered from (Finalization-)Lobby" |
|
1629 |
||
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1630 |
self setDevice:nil id:nil gcId:nil |
2 | 1631 |
! ! |
1632 |
||
1633 |
||
278 | 1634 |
!Form methodsFor:'printing & storing'! |
107 | 1635 |
|
7493 | 1636 |
displayOn:aStreamOrGC |
1637 |
super displayOn:aStreamOrGC. |
|
1638 |
aStreamOrGC isStream ifTrue:[ |
|
1639 |
aStreamOrGC nextPutAll:' (depth='. |
|
1640 |
depth printOn:aStreamOrGC. |
|
1641 |
aStreamOrGC nextPut:$). |
|
1642 |
]. |
|
1643 |
! |
|
1644 |
||
278 | 1645 |
storeOn:aStream |
588 | 1646 |
"append an ascii representation of the receiver to aStream, |
1647 |
from which a copy of the receiver can be reconstructed" |
|
1648 |
||
278 | 1649 |
aStream nextPutAll:'(Form width:'. |
1650 |
width storeOn:aStream. |
|
1651 |
aStream nextPutAll:' height:'. |
|
1652 |
height storeOn:aStream. |
|
1653 |
aStream nextPutAll:' fromArray:('. |
|
1654 |
self bits storeOn:aStream. |
|
1655 |
aStream nextPutAll:'))' |
|
588 | 1656 |
|
1657 |
"Modified: 23.4.1996 / 10:21:10 / cg" |
|
107 | 1658 |
! ! |
1659 |
||
0 | 1660 |
!Form methodsFor:'private'! |
1661 |
||
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
|
1662 |
beImmediateForm |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1663 |
"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
|
1664 |
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
|
1665 |
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
|
1666 |
|
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
|
1667 |
data isNil ifTrue:[ |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1668 |
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
|
1669 |
] |
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
|
1670 |
|
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
|
1671 |
" |
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
|
1672 |
Form allInstances:[:f | |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1058
diff
changeset
|
1673 |
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
|
1674 |
] |
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
|
1675 |
" |
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
|
1676 |
|
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
|
1677 |
"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
|
1678 |
! |
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
|
1679 |
|
870
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1680 |
flushDeviceHandles |
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1681 |
"flush device handles (sent after a restart)" |
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1682 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1683 |
self setDevice:device id:nil gcId:nil. |
870
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1684 |
|
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1685 |
"Created: 15.6.1996 / 15:44:28 / cg" |
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1686 |
! |
2b7db80e7ad1
oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents:
836
diff
changeset
|
1687 |
|
54 | 1688 |
getBits |
1689 |
"if the receiver was not created from a file, or |
|
1690 |
an array (i.e. it was drawn), read the pixels from the |
|
1691 |
device into a local data array. This has to be done before |
|
1692 |
an image is saved, or the receiver is storedBinary, since |
|
1693 |
the information present in the device is lost after restart/reload" |
|
1694 |
||
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1695 |
data isNil ifTrue:[ |
78 | 1696 |
data := self bits |
54 | 1697 |
] |
1698 |
! |
|
1699 |
||
1058 | 1700 |
restored |
1701 |
"flush device data, when restored (sent after a binaryLoad)" |
|
1702 |
||
1703 |
self release |
|
1704 |
||
1705 |
"Modified: 16.9.1996 / 21:08:57 / cg" |
|
278 | 1706 |
! |
1707 |
||
0 | 1708 |
width:w height:h |
54 | 1709 |
"actual create of a monochrome form" |
0 | 1710 |
|
6227 | 1711 |
^ self width:w height:h depth:1. |
0 | 1712 |
! |
1713 |
||
1714 |
width:w height:h depth:d |
|
7355 | 1715 |
"actual create of an arbitrary deep form (but, must be supported by device). |
1716 |
Return nil (after raising a notification) if the allocation failed" |
|
0 | 1717 |
|
6227 | 1718 |
((w == 0) or:[h == 0]) ifTrue:[ |
8168 | 1719 |
self error:'invalid form extent' mayProceed:true. |
1720 |
^ nil |
|
6227 | 1721 |
]. |
0 | 1722 |
width := w. |
1723 |
height := h. |
|
1724 |
offset := 0@0. |
|
1725 |
depth := d. |
|
6227 | 1726 |
depth == 1 ifTrue:[ |
7427 | 1727 |
localColorMap isNil ifTrue:[ |
1728 |
BlackAndWhiteColorMap isNil ifTrue:[ |
|
1729 |
BlackAndWhiteColorMap := Array with:(Color white) with:(Color black) |
|
1730 |
]. |
|
1731 |
localColorMap := BlackAndWhiteColorMap. |
|
1732 |
]. |
|
6227 | 1733 |
]. |
7260 | 1734 |
device notNil ifTrue:[ |
7427 | 1735 |
(gc createPixmapWidth:w height:h depth:d) isNil ifTrue:[^nil]. |
1736 |
realized := gc drawableId notNil. |
|
3067
908e910e6c94
allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents:
3025
diff
changeset
|
1737 |
]. |
8168 | 1738 |
|
1739 |
"Modified: / 06-09-2017 / 12:30:46 / Maren" |
|
0 | 1740 |
! |
1741 |
||
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1742 |
width:wIn height:hIn fromArray:anArray |
54 | 1743 |
"actual create of a monochrome form from array. |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1744 |
This method is somewhat more complicated as it should be due to |
0 | 1745 |
supporting both byte-wise (ST/X-type) and short-word-wise (ST-80-type) |
1746 |
Arrays; in the later case, the shorts are first converted to bytes in |
|
1747 |
a ByteArray, then passed to the device." |
|
1748 |
||
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1749 |
|bytes bits |
134 | 1750 |
srcPerRow "{ Class: SmallInteger }" |
1751 |
dstPerRow "{ Class: SmallInteger }" |
|
1752 |
srcStart "{ Class: SmallInteger }" |
|
1753 |
srcIndex "{ Class: SmallInteger }" |
|
1754 |
dstIndex "{ Class: SmallInteger }" |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1755 |
w "{ Class: SmallInteger }" |
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1756 |
h "{ Class: SmallInteger }" |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1757 |
sz "{ Class: SmallInteger }" | |
0 | 1758 |
|
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1759 |
w := wIn. |
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1760 |
h := hIn. |
8168 | 1761 |
((w == 0) or:[h == 0]) ifTrue:[ |
1762 |
self error:'invalid form extent' mayProceed:true. |
|
1763 |
^ nil |
|
1764 |
]. |
|
0 | 1765 |
bytes := anArray. |
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1766 |
sz := anArray size. |
0 | 1767 |
|
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1768 |
sz ~~ (((w + 7) // 8) * h) ifTrue:[ |
8168 | 1769 |
"/ not bytes ... |
1770 |
sz == (((w + 15) // 16) * h) ifTrue:[ |
|
1771 |
"I want the bytes but got shorts (ST-80)" |
|
1772 |
bytes := ByteArray uninitializedNew:(((w + 7) // 8) * h). |
|
1773 |
srcPerRow := (w + 15) // 16. |
|
1774 |
dstPerRow := (w + 7) // 8. |
|
1775 |
srcStart := 1. |
|
1776 |
dstIndex := 1. |
|
2773
8aefa2576a50
a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents:
2473
diff
changeset
|
1777 |
|
8168 | 1778 |
1 to:h do:[:hi | |
1779 |
srcIndex := srcStart. |
|
1780 |
bits := anArray at:srcIndex. |
|
1781 |
1 to:dstPerRow do:[:di | |
|
1782 |
di odd ifTrue:[ |
|
1783 |
bits := anArray at:srcIndex. |
|
1784 |
bytes at:dstIndex put:(bits bitShift:-8) |
|
1785 |
] ifFalse:[ |
|
1786 |
bytes at:dstIndex put:(bits bitAnd:16rFF). |
|
1787 |
srcIndex := srcIndex + 1 |
|
1788 |
]. |
|
1789 |
dstIndex := dstIndex + 1 |
|
1790 |
]. |
|
1791 |
srcStart := srcStart + srcPerRow |
|
1792 |
] |
|
1793 |
] ifFalse:[ |
|
1794 |
sz == (((w + 31) // 32) * h) ifTrue:[ |
|
1795 |
"I want the bytes but got longs (Squeak)" |
|
3020 | 1796 |
|
8168 | 1797 |
bytes := ByteArray uninitializedNew:(((w + 7) // 8) * h). |
1798 |
srcPerRow := (w + 31) // 32. |
|
1799 |
dstPerRow := (w + 7) // 8. |
|
1800 |
srcStart := 1. |
|
1801 |
dstIndex := 1. |
|
3020 | 1802 |
|
8168 | 1803 |
1 to:h do:[:hi | |
1804 |
|ss| |
|
3020 | 1805 |
|
8168 | 1806 |
srcIndex := srcStart. |
1807 |
bits := anArray at:srcIndex. |
|
1808 |
ss := 0. |
|
1809 |
1 to:dstPerRow do:[:di | |
|
1810 |
ss == 0 ifTrue:[ |
|
1811 |
bits := anArray at:srcIndex. |
|
1812 |
]. |
|
1813 |
bytes at:dstIndex put:((bits bitShift:-24) bitAnd:16rFF). |
|
1814 |
bits := bits bitShift:8. |
|
1815 |
ss := ss + 1. |
|
1816 |
ss == 4 ifTrue:[ |
|
1817 |
srcIndex := srcIndex + 1. |
|
1818 |
ss := 0. |
|
1819 |
]. |
|
1820 |
dstIndex := dstIndex + 1 |
|
1821 |
]. |
|
1822 |
srcStart := srcStart + srcPerRow |
|
1823 |
] |
|
1824 |
] |
|
1825 |
] |
|
0 | 1826 |
]. |
1827 |
data := bytes. |
|
6230 | 1828 |
width := w. |
1829 |
height := h. |
|
1830 |
depth := 1. |
|
1831 |
offset := 0@0. |
|
6483 | 1832 |
|
1833 |
localColorMap isNil ifTrue:[ |
|
8168 | 1834 |
BlackAndWhiteColorMap isNil ifTrue:[ |
1835 |
BlackAndWhiteColorMap := Array with:(Color white) with:(Color black) |
|
1836 |
]. |
|
1837 |
localColorMap := BlackAndWhiteColorMap. |
|
6230 | 1838 |
]. |
6483 | 1839 |
|
7260 | 1840 |
device notNil ifTrue:[ |
8168 | 1841 |
gc createBitmapFromArray:bytes width:w height:h. |
1842 |
realized := true. |
|
6230 | 1843 |
]. |
8168 | 1844 |
|
1845 |
"Modified: / 06-09-2017 / 12:33:17 / Maren" |
|
0 | 1846 |
! |
1847 |
||
1848 |
width:w height:h offset:offs fromArray:anArray |
|
54 | 1849 |
"actual create of a monochrome form from array" |
0 | 1850 |
|
1851 |
self width:w height:h fromArray:anArray. |
|
1852 |
offset := offs |
|
1853 |
! ! |
|
1854 |
||
3177 | 1855 |
!Form methodsFor:'queries'! |
99 | 1856 |
|
3812 | 1857 |
ascentOn:aGC |
1858 |
"displayOn: does not draw above baseline" |
|
1859 |
||
1860 |
^ 0 |
|
1861 |
! |
|
1862 |
||
680
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
1863 |
bounds |
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
1864 |
"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
|
1865 |
|
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
1866 |
^ 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
|
1867 |
|
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
1868 |
"Modified: 13.5.1996 / 10:26:13 / cg" |
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
1869 |
! |
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
1870 |
|
910
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
1871 |
colorFromValue:pixel |
1200 | 1872 |
"given a pixelValue, return the corresponding color. |
1873 |
For compatibility with Images" |
|
1874 |
||
910
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
1875 |
localColorMap notNil ifTrue:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1876 |
^ localColorMap at:(pixel + 1) |
910
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
1877 |
]. |
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
1878 |
depth == 1 ifTrue:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1879 |
pixel == 0 ifTrue:[^ self whiteColor]. |
910
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
1880 |
]. |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1881 |
^ self blackColor |
910
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
1882 |
|
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
1883 |
"Created: 28.6.1996 / 16:10:13 / cg" |
1200 | 1884 |
"Modified: 13.1.1997 / 23:06:25 / cg" |
910
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
1885 |
! |
6a19a80f66b4
added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents:
897
diff
changeset
|
1886 |
|
925 | 1887 |
hasBits |
1888 |
"return true, if the receiver has its pixel data available. |
|
1889 |
For forms, which were created from data, this is always true. |
|
1890 |
For forms, which were created as off-screen device forms on some |
|
1891 |
device, this is always false." |
|
1892 |
||
1893 |
^ data notNil |
|
1894 |
||
1895 |
"Created: 5.7.1996 / 16:21:20 / cg" |
|
1896 |
! |
|
1897 |
||
673 | 1898 |
heightOn:aGC |
674 | 1899 |
"return my height, if displayed on aGC; |
1900 |
since my height is independent of the device (the number of pixels), |
|
1901 |
return the pixel-height" |
|
1902 |
||
680
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
1903 |
^ height |
673 | 1904 |
|
1905 |
"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
|
1906 |
"Modified: 13.5.1996 / 10:26:09 / cg" |
673 | 1907 |
! |
1908 |
||
3700
9b40f1e55270
dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents:
3655
diff
changeset
|
1909 |
isDithered |
9b40f1e55270
dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents:
3655
diff
changeset
|
1910 |
"for compatibility with color protocol" |
9b40f1e55270
dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents:
3655
diff
changeset
|
1911 |
|
9b40f1e55270
dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents:
3655
diff
changeset
|
1912 |
^ false |
9b40f1e55270
dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents:
3655
diff
changeset
|
1913 |
! |
9b40f1e55270
dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents:
3655
diff
changeset
|
1914 |
|
99 | 1915 |
isForm |
1916 |
"return true, if the receiver is some kind of form; |
|
1917 |
true is returned here - the method is redefined from Object." |
|
1918 |
||
1919 |
^ true |
|
1920 |
! |
|
1921 |
||
1922 |
isImageOrForm |
|
1923 |
"return true, if the receiver is some kind of image or form; |
|
1924 |
true is returned here - the method is redefined from Object." |
|
1925 |
||
1926 |
^ true |
|
673 | 1927 |
! |
1928 |
||
1929 |
widthOn:aGC |
|
674 | 1930 |
"return my width, if displayed on aGC; |
1931 |
since my width is independent of the device (the number of pixels), |
|
1932 |
return the pixel-width" |
|
1933 |
||
680
a905d02dcb82
added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents:
674
diff
changeset
|
1934 |
^ width |
673 | 1935 |
|
1936 |
"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
|
1937 |
"Modified: 13.5.1996 / 10:26:05 / cg" |
99 | 1938 |
! ! |
1939 |
||
4173
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1940 |
!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
|
1941 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1942 |
documentation |
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 |
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
|
1945 |
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
|
1946 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1947 |
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
|
1948 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1949 |
[author:] |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7381
diff
changeset
|
1950 |
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
|
1951 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1952 |
[instance variables:] |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1953 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1954 |
[class variables:] |
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 |
[see also:] |
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 |
! ! |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1960 |
|
7493 | 1961 |
!Form::ImageForm methodsFor:'converting'! |
1962 |
||
1963 |
asImageForm |
|
1964 |
^ self |
|
1965 |
! ! |
|
1966 |
||
4173
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1967 |
!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
|
1968 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1969 |
getBits |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1970 |
"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
|
1971 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1972 |
^ self |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1973 |
! |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1974 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1975 |
recreate |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1976 |
"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
|
1977 |
|
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1978 |
^ self |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1979 |
! ! |
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4165
diff
changeset
|
1980 |
|
1142
2a83bf7d5627
Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
1981 |
!Form class methodsFor:'documentation'! |
134 | 1982 |
|
278 | 1983 |
version |
7106 | 1984 |
^ '$Header$' |
7355 | 1985 |
! |
1986 |
||
1987 |
version_CVS |
|
1988 |
^ '$Header$' |
|
0 | 1989 |
! ! |
3811 | 1990 |
|
6046 | 1991 |
|
278 | 1992 |
Form initialize! |