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