0
|
1 |
"
|
6
|
2 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
78
|
3 |
All Rights Reserved
|
0
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
DeviceDrawable subclass:#Form
|
|
14 |
instanceVariableNames:'depth localColorMap offset data fileName'
|
|
15 |
classVariableNames:'VeryLightGreyForm LightGreyForm GreyForm
|
78
|
16 |
DarkGreyForm VeryDarkGreyForm
|
0
|
17 |
|
78
|
18 |
AdditionalBitmapDirectoryNames
|
126
|
19 |
BlackAndWhiteColorMap DitherPatternArray'
|
0
|
20 |
poolDictionaries:''
|
|
21 |
category:'Graphics-Display Objects'
|
|
22 |
!
|
|
23 |
|
|
24 |
Form comment:'
|
46
|
25 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
78
|
26 |
All Rights Reserved
|
54
|
27 |
|
151
|
28 |
$Header: /cvs/stx/stx/libview/Form.st,v 1.27 1995-06-06 04:06:45 claus Exp $
|
46
|
29 |
'!
|
0
|
30 |
|
46
|
31 |
!Form class methodsFor:'documentation'!
|
|
32 |
|
|
33 |
copyright
|
|
34 |
"
|
|
35 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
78
|
36 |
All Rights Reserved
|
0
|
37 |
|
46
|
38 |
This software is furnished under a license and may be used
|
|
39 |
only in accordance with the terms of that license and with the
|
|
40 |
inclusion of the above copyright notice. This software may not
|
|
41 |
be provided or otherwise made available to, or used by, any
|
|
42 |
other person. No title to or ownership of the software is
|
|
43 |
hereby transferred.
|
|
44 |
"
|
|
45 |
!
|
|
46 |
|
|
47 |
version
|
|
48 |
"
|
151
|
49 |
$Header: /cvs/stx/stx/libview/Form.st,v 1.27 1995-06-06 04:06:45 claus Exp $
|
46
|
50 |
"
|
|
51 |
!
|
|
52 |
|
|
53 |
documentation
|
|
54 |
"
|
|
55 |
Instances of this class represent forms (i.e. bit- and pixmaps)
|
|
56 |
which can be created on the drawing device. In X, these are XPixmaps.
|
|
57 |
Not all devices will support forms.
|
134
|
58 |
|
|
59 |
NOTICE:
|
|
60 |
the Form class is a historic leftover and now only used for real
|
|
61 |
device forms (i.e. on devices which support downloading bitmaps).
|
|
62 |
In your application, you should always use Image, both for compatibility
|
|
63 |
with ST-80 and for device independence, since Form may not be supported
|
|
64 |
by all devices (for example: PostscriptPrinters).
|
46
|
65 |
"
|
|
66 |
! !
|
0
|
67 |
|
|
68 |
!Form class methodsFor:'initialization'!
|
|
69 |
|
|
70 |
initialize
|
126
|
71 |
"initialize set of dictionaries to look for bitmaps"
|
0
|
72 |
|
|
73 |
AdditionalBitmapDirectoryNames isNil ifTrue:[
|
78
|
74 |
AdditionalBitmapDirectoryNames := #('/usr/lib/X11/bitmaps').
|
0
|
75 |
|
78
|
76 |
"want to be informed when returning from snapshot"
|
|
77 |
ObjectMemory addDependent:self.
|
0
|
78 |
]
|
|
79 |
!
|
|
80 |
|
|
81 |
reinitializeAllOn:aDevice
|
|
82 |
"recreate all forms on aDevice; called by Workstation, to
|
|
83 |
have all background bitmaps at hand, when views are restored"
|
|
84 |
|
127
|
85 |
Lobby do:[:aDrawable |
|
|
86 |
(aDrawable device == aDevice) ifTrue:[
|
|
87 |
aDrawable isForm ifTrue:[
|
126
|
88 |
"now, try to recreate it"
|
127
|
89 |
aDrawable recreate.
|
126
|
90 |
]
|
78
|
91 |
]
|
0
|
92 |
]
|
|
93 |
!
|
|
94 |
|
|
95 |
update:something
|
|
96 |
"sent just before snapOut and just after a snapIn"
|
|
97 |
|
|
98 |
(something == #save) ifTrue:[
|
78
|
99 |
"get all bits from the device into saveable arrays"
|
127
|
100 |
Lobby do:[:aDrawable |
|
|
101 |
aDrawable isForm ifTrue:[
|
|
102 |
aDrawable getBits
|
126
|
103 |
]
|
78
|
104 |
]
|
0
|
105 |
].
|
|
106 |
(something == #restarted) ifTrue:[
|
78
|
107 |
"remove all left-over device info"
|
127
|
108 |
Lobby do:[:aDrawable |
|
|
109 |
aDrawable isForm ifTrue:[
|
|
110 |
aDrawable restored.
|
|
111 |
Lobby changed:aDrawable
|
126
|
112 |
]
|
78
|
113 |
]
|
0
|
114 |
]
|
|
115 |
! !
|
|
116 |
|
109
|
117 |
!Form methodsFor:'inspecting'!
|
|
118 |
|
|
119 |
inspectorClass
|
|
120 |
"redefined to launch an ImageInspector
|
|
121 |
(instead of the default InspectorView)."
|
|
122 |
|
|
123 |
^ ImageInspectorView
|
|
124 |
! !
|
|
125 |
|
12
|
126 |
!Form class methodsFor:'cleanup'!
|
|
127 |
|
|
128 |
lowSpaceCleanup
|
|
129 |
"cleanup in low-memory situations"
|
|
130 |
|
54
|
131 |
DitherPatternArray := nil
|
12
|
132 |
! !
|
|
133 |
|
71
|
134 |
!Form methodsFor:'copying'!
|
|
135 |
|
|
136 |
postCopy
|
|
137 |
super postCopy.
|
|
138 |
localColorMap := localColorMap copy.
|
|
139 |
data := data copy
|
151
|
140 |
!
|
|
141 |
|
|
142 |
shallowCopyForFinalization
|
|
143 |
"redefined for faster creation of finalization copies
|
|
144 |
(only device, gcId and drawableId are needed)"
|
|
145 |
|
|
146 |
|aCopy|
|
|
147 |
|
|
148 |
aCopy := DeviceFormHandle basicNew.
|
|
149 |
aCopy setDevice:device id:drawableId gcId:gcId.
|
|
150 |
^ aCopy
|
71
|
151 |
! !
|
|
152 |
|
0
|
153 |
!Form methodsFor:'instance release'!
|
|
154 |
|
151
|
155 |
XXdisposed
|
0
|
156 |
"some Form has been collected - tell it to the x-server"
|
|
157 |
|
|
158 |
drawableId notNil ifTrue:[
|
118
|
159 |
gcId notNil ifTrue:[
|
|
160 |
device destroyGC:gcId.
|
|
161 |
gcId := nil
|
|
162 |
].
|
78
|
163 |
device destroyPixmap:drawableId.
|
118
|
164 |
drawableId := nil
|
0
|
165 |
]
|
|
166 |
! !
|
|
167 |
|
|
168 |
!Form class methodsFor:'file search'!
|
|
169 |
|
|
170 |
findBitmapFile:fileName
|
|
171 |
"find the bitmap file in one of the standard places;
|
|
172 |
return the pathName or nil"
|
|
173 |
|
|
174 |
|aStream path|
|
|
175 |
|
|
176 |
((fileName at:1) == $/) ifTrue:[^ fileName].
|
|
177 |
(fileName startsWith:'../') ifTrue:[^ fileName].
|
|
178 |
(fileName startsWith:'./') ifTrue:[^ fileName].
|
127
|
179 |
fileName asFilename exists ifTrue:[^ fileName].
|
0
|
180 |
|
134
|
181 |
aStream := Smalltalk bitmapFileStreamFor:fileName.
|
0
|
182 |
aStream notNil ifTrue:[
|
78
|
183 |
path := aStream pathName.
|
|
184 |
aStream close.
|
|
185 |
^ path
|
0
|
186 |
].
|
|
187 |
AdditionalBitmapDirectoryNames notNil ifTrue:[
|
78
|
188 |
AdditionalBitmapDirectoryNames do:[:aPath |
|
|
189 |
path := aPath , '/' , fileName.
|
|
190 |
(OperatingSystem isReadable:path) ifTrue:[
|
|
191 |
^ path
|
|
192 |
]
|
|
193 |
]
|
0
|
194 |
].
|
|
195 |
^ nil
|
|
196 |
! !
|
|
197 |
|
|
198 |
!Form class methodsFor:'private instance creation'!
|
|
199 |
|
|
200 |
grey:percent on:aDevice
|
|
201 |
"return a form for dithering"
|
|
202 |
|
|
203 |
(percent < 20) ifTrue:[^ Color black on:aDevice].
|
|
204 |
(percent < 40) ifTrue:[^ self darkGreyFormOn:aDevice].
|
|
205 |
(percent < 60) ifTrue:[^ self mediumGreyFormOn:aDevice].
|
|
206 |
(percent < 80) ifTrue:[^ self lightGreyFormOn:aDevice].
|
|
207 |
^ Color white on:aDevice
|
|
208 |
!
|
|
209 |
|
|
210 |
mediumGreyFormOn:aDevice
|
|
211 |
"return a grey form"
|
|
212 |
|
54
|
213 |
|f|
|
|
214 |
|
|
215 |
((aDevice == Display) and:[GreyForm notNil]) ifTrue:[
|
78
|
216 |
^ GreyForm
|
0
|
217 |
].
|
54
|
218 |
|
|
219 |
f := self width:8 height:4 fromArray:(self greyFormBits) on:aDevice.
|
|
220 |
(aDevice == Display) ifTrue:[
|
78
|
221 |
GreyForm := f
|
0
|
222 |
].
|
54
|
223 |
^ f
|
0
|
224 |
!
|
|
225 |
|
|
226 |
veryLightGreyFormOn:aDevice
|
|
227 |
"return a veryLightGrey form"
|
|
228 |
|
54
|
229 |
|f|
|
|
230 |
|
|
231 |
((aDevice == Display) and:[VeryLightGreyForm notNil]) ifTrue:[
|
78
|
232 |
^ VeryLightGreyForm
|
0
|
233 |
].
|
54
|
234 |
|
|
235 |
f := self width:8 height:4 fromArray:(self veryLightGreyFormBits) on:aDevice.
|
|
236 |
(aDevice == Display) ifTrue:[
|
78
|
237 |
VeryLightGreyForm := f
|
0
|
238 |
].
|
54
|
239 |
^ f
|
0
|
240 |
!
|
|
241 |
|
|
242 |
lightGreyFormOn:aDevice
|
|
243 |
"return a lightGrey form"
|
|
244 |
|
54
|
245 |
|f|
|
|
246 |
|
|
247 |
((aDevice == Display) and:[LightGreyForm notNil]) ifTrue:[
|
78
|
248 |
^ LightGreyForm
|
0
|
249 |
].
|
54
|
250 |
|
|
251 |
f := self width:8 height:4 fromArray:(self lightGreyFormBits) on:aDevice.
|
|
252 |
(aDevice == Display) ifTrue:[
|
78
|
253 |
LightGreyForm := f
|
0
|
254 |
].
|
54
|
255 |
^ f
|
0
|
256 |
!
|
|
257 |
|
|
258 |
darkGreyFormOn:aDevice
|
|
259 |
"return a darkGrey form"
|
|
260 |
|
54
|
261 |
|f|
|
|
262 |
|
|
263 |
((aDevice == Display) and:[DarkGreyForm notNil]) ifTrue:[
|
78
|
264 |
^ DarkGreyForm
|
0
|
265 |
].
|
54
|
266 |
|
|
267 |
f := self width:8 height:4 fromArray:(self darkGreyFormBits) on:aDevice.
|
|
268 |
(aDevice == Display) ifTrue:[
|
78
|
269 |
DarkGreyForm := f
|
0
|
270 |
].
|
54
|
271 |
^ f
|
0
|
272 |
!
|
|
273 |
|
|
274 |
veryDarkGreyFormOn:aDevice
|
|
275 |
"return a veryDarkGrey form"
|
|
276 |
|
54
|
277 |
|f|
|
|
278 |
|
|
279 |
((aDevice == Display) and:[VeryDarkGreyForm notNil]) ifTrue:[
|
78
|
280 |
^ VeryDarkGreyForm
|
0
|
281 |
].
|
54
|
282 |
|
|
283 |
f := self width:8 height:4 fromArray:(self veryDarkGreyFormBits) on:aDevice.
|
|
284 |
(aDevice == Display) ifTrue:[
|
78
|
285 |
VeryDarkGreyForm := f
|
0
|
286 |
].
|
54
|
287 |
^ f
|
0
|
288 |
! !
|
|
289 |
|
|
290 |
!Form class methodsFor:'ST-80 compatibility'!
|
|
291 |
|
|
292 |
over
|
|
293 |
"return a constant usable as bitblt-combinationrule"
|
|
294 |
|
|
295 |
^ #copy
|
|
296 |
!
|
|
297 |
|
98
|
298 |
paint
|
|
299 |
"return a constant usable as bitblt-combinationrule"
|
|
300 |
|
|
301 |
^ #copy
|
|
302 |
!
|
|
303 |
|
0
|
304 |
under
|
|
305 |
"return a constant usable as bitblt-combinationrule"
|
|
306 |
|
|
307 |
^ #or
|
|
308 |
!
|
|
309 |
|
|
310 |
reverse
|
|
311 |
"return a constant usable as bitblt-combinationrule"
|
|
312 |
|
|
313 |
^ #xor
|
89
|
314 |
!
|
|
315 |
|
|
316 |
and
|
|
317 |
"return a constant usable as bitblt-combinationrule"
|
|
318 |
|
|
319 |
^ #and
|
0
|
320 |
! !
|
|
321 |
|
|
322 |
!Form class methodsFor:'instance creation'!
|
|
323 |
|
|
324 |
extent:ext
|
35
|
325 |
"create a new, cleared form, take dimensions from ext.
|
0
|
326 |
Smalltalk-80 compatibility"
|
|
327 |
|
|
328 |
|newForm|
|
|
329 |
|
|
330 |
newForm := self width:(ext x) height:(ext y).
|
|
331 |
newForm fill:(Color colorId:0).
|
|
332 |
newForm paint:(Color colorId:1).
|
|
333 |
^ newForm
|
|
334 |
!
|
|
335 |
|
89
|
336 |
extent:ext offset:anOffset
|
|
337 |
"create a new, cleared form, take dimensions from ext.
|
|
338 |
Smalltalk-80 compatibility"
|
|
339 |
|
|
340 |
^ (self extent:ext) offset:anOffset.
|
|
341 |
!
|
|
342 |
|
98
|
343 |
extent:ext fromArray:data
|
|
344 |
"create a new form, take dimensions from ext, bits from data.
|
|
345 |
Smalltalk-80 compatibility."
|
|
346 |
|
|
347 |
^ self width:(ext x) height:(ext y) offset:0@0 fromArray:data
|
|
348 |
!
|
|
349 |
|
0
|
350 |
extent:ext fromArray:data offset:offs
|
|
351 |
"create a new form, take dimensions from ext, bits from data.
|
|
352 |
Smalltalk-80 compatibility."
|
|
353 |
|
|
354 |
^ self width:(ext x) height:(ext y) offset:offs fromArray:data
|
|
355 |
!
|
|
356 |
|
|
357 |
width:w height:h on:aDevice
|
|
358 |
"create a new form on device, aDevice; depth is what device likes most"
|
|
359 |
|
|
360 |
^ (self on:aDevice) width:w height:h
|
|
361 |
!
|
|
362 |
|
|
363 |
width:w height:h depth:d on:aDevice
|
|
364 |
"create a new form with depth d on device, aDevice"
|
|
365 |
|
|
366 |
^ (self on:aDevice) width:w height:h depth:d
|
|
367 |
!
|
|
368 |
|
|
369 |
width:w height:h fromArray:anArray on:aDevice
|
|
370 |
"create a new form on device, aDevice and
|
|
371 |
initialize the pixels from anArray"
|
|
372 |
|
|
373 |
^ (self on:aDevice) width:w height:h fromArray:anArray
|
|
374 |
!
|
|
375 |
|
|
376 |
width:w height:h
|
|
377 |
"create a new form on the default device"
|
|
378 |
|
|
379 |
^ (self on:Display) width:w height:h
|
|
380 |
!
|
|
381 |
|
|
382 |
width:w height:h depth:d
|
|
383 |
"create a new form on the default device"
|
|
384 |
|
|
385 |
^ (self on:Display) width:w height:h depth:d
|
|
386 |
!
|
|
387 |
|
|
388 |
width:w height:h fromArray:anArray
|
|
389 |
"create a new form on the default device"
|
|
390 |
|
|
391 |
^ (self on:Display) width:w height:h fromArray:anArray
|
|
392 |
!
|
|
393 |
|
|
394 |
width:w height:h offset:offs fromArray:anArray
|
|
395 |
"create a new form on the default device"
|
|
396 |
|
|
397 |
^ (self on:Display) width:w height:h offset:offs fromArray:anArray
|
|
398 |
!
|
|
399 |
|
|
400 |
white
|
|
401 |
"ST80 compatibility;
|
54
|
402 |
in st80, return a white form - here we return white color"
|
0
|
403 |
|
|
404 |
^ Color white
|
|
405 |
!
|
|
406 |
|
|
407 |
black
|
|
408 |
"ST80 compatibility;
|
54
|
409 |
in st80, return a black form - here we return black color"
|
0
|
410 |
|
|
411 |
^ Color black
|
|
412 |
!
|
|
413 |
|
|
414 |
gray
|
|
415 |
"ST80 compatibility;
|
54
|
416 |
in st80, return a grey form - here we return grey color"
|
0
|
417 |
|
|
418 |
^ self grey
|
|
419 |
!
|
|
420 |
|
|
421 |
grey
|
|
422 |
"ST80 compatibility;
|
54
|
423 |
in st80, return a grey form - here we return grey color"
|
0
|
424 |
|
|
425 |
^ Color grey
|
|
426 |
!
|
|
427 |
|
|
428 |
lightGrey
|
|
429 |
"ST80 compatibility;
|
54
|
430 |
in st80, return a lightGrey form - here we return lightGrey color"
|
0
|
431 |
|
|
432 |
^ Color lightGrey
|
|
433 |
!
|
|
434 |
|
|
435 |
darkGrey
|
|
436 |
"ST80 compatibility;
|
54
|
437 |
in st80, return a darkGrey form - here we return darkGrey color"
|
0
|
438 |
|
|
439 |
^ Color darkGrey
|
|
440 |
!
|
|
441 |
|
|
442 |
darkGray
|
|
443 |
"ST80 compatibility;
|
54
|
444 |
in st80, return a darkGrey form - here we return darkGrey color"
|
0
|
445 |
|
|
446 |
^ Color darkGrey
|
|
447 |
! !
|
|
448 |
|
|
449 |
!Form class methodsFor:'patterns'!
|
|
450 |
|
|
451 |
ditherBitsForXin64:x
|
26
|
452 |
"return a dither pattern for x/64; x in 1..63"
|
0
|
453 |
|
|
454 |
|sel|
|
|
455 |
|
54
|
456 |
DitherPatternArray isNil ifTrue:[
|
78
|
457 |
DitherPatternArray := Array new:63.
|
|
458 |
1 to:63 do:[:i |
|
|
459 |
"
|
|
460 |
compute the selector as #'dither<n>in64'
|
|
461 |
"
|
|
462 |
sel := ('dither' , i printString , 'in64') asSymbol.
|
|
463 |
DitherPatternArray at:i put:(self perform:sel)
|
|
464 |
]
|
0
|
465 |
].
|
54
|
466 |
^ DitherPatternArray at:x
|
0
|
467 |
!
|
|
468 |
|
|
469 |
dither1in64
|
|
470 |
"return a pattern for dithering"
|
|
471 |
|
2
|
472 |
^ #[2r10000000
|
78
|
473 |
2r00000000
|
|
474 |
2r00000000
|
|
475 |
2r00000000
|
|
476 |
2r00000000
|
|
477 |
2r00000000
|
|
478 |
2r00000000
|
|
479 |
2r00000000]
|
0
|
480 |
!
|
|
481 |
|
|
482 |
dither2in64
|
|
483 |
"return a pattern for dithering"
|
|
484 |
|
2
|
485 |
^ #[2r10000000
|
78
|
486 |
2r00000000
|
|
487 |
2r00000000
|
|
488 |
2r00000000
|
|
489 |
2r00001000
|
|
490 |
2r00000000
|
|
491 |
2r00000000
|
|
492 |
2r00000000]
|
0
|
493 |
!
|
|
494 |
|
|
495 |
dither3in64
|
|
496 |
"return a pattern for dithering"
|
|
497 |
|
2
|
498 |
^ #[2r10000000
|
78
|
499 |
2r00000000
|
|
500 |
2r00000000
|
|
501 |
2r00000000
|
|
502 |
2r10001000
|
|
503 |
2r00000000
|
|
504 |
2r00000000
|
|
505 |
2r00000000]
|
0
|
506 |
!
|
|
507 |
|
|
508 |
dither4in64
|
|
509 |
"return a pattern for dithering"
|
|
510 |
|
2
|
511 |
^ #[2r10001000
|
78
|
512 |
2r00000000
|
|
513 |
2r00000000
|
|
514 |
2r00000000
|
|
515 |
2r10001000
|
|
516 |
2r00000000
|
|
517 |
2r00000000
|
|
518 |
2r00000000]
|
0
|
519 |
!
|
|
520 |
|
|
521 |
dither5in64
|
|
522 |
"return a pattern for dithering"
|
|
523 |
|
2
|
524 |
^ #[2r10001000
|
78
|
525 |
2r00000000
|
|
526 |
2r00000000
|
|
527 |
2r00000000
|
|
528 |
2r10001000
|
|
529 |
2r00000000
|
|
530 |
2r00000010
|
|
531 |
2r00000000]
|
0
|
532 |
!
|
|
533 |
|
|
534 |
dither6in64
|
|
535 |
"return a pattern for dithering"
|
|
536 |
|
2
|
537 |
^ #[2r10001000
|
78
|
538 |
2r00000000
|
|
539 |
2r00100000
|
|
540 |
2r00000000
|
|
541 |
2r10001000
|
|
542 |
2r00000000
|
|
543 |
2r00000010
|
|
544 |
2r00000000]
|
0
|
545 |
!
|
|
546 |
|
|
547 |
dither7in64
|
|
548 |
"return a pattern for dithering"
|
|
549 |
|
2
|
550 |
^ #[2r10001000
|
78
|
551 |
2r00000000
|
|
552 |
2r00100010
|
|
553 |
2r00000000
|
|
554 |
2r10001000
|
|
555 |
2r00000000
|
|
556 |
2r00000010
|
|
557 |
2r00000000]
|
0
|
558 |
!
|
|
559 |
|
|
560 |
dither8in64
|
|
561 |
"return a pattern for dithering"
|
|
562 |
|
2
|
563 |
^ #[2r10001000
|
78
|
564 |
2r00000000
|
|
565 |
2r00100010
|
|
566 |
2r00000000
|
|
567 |
2r10001000
|
|
568 |
2r00000000
|
|
569 |
2r00100010
|
|
570 |
2r00000000]
|
0
|
571 |
!
|
|
572 |
|
|
573 |
dither9in64
|
|
574 |
"return a pattern for dithering"
|
|
575 |
|
2
|
576 |
^ #[2r10001000
|
78
|
577 |
2r00000000
|
|
578 |
2r00100010
|
|
579 |
2r00000000
|
|
580 |
2r10001000
|
|
581 |
2r00000000
|
|
582 |
2r10100010
|
|
583 |
2r00000000]
|
0
|
584 |
!
|
|
585 |
|
|
586 |
dither10in64
|
|
587 |
"return a pattern for dithering"
|
|
588 |
|
2
|
589 |
^ #[2r10001000
|
78
|
590 |
2r00000000
|
|
591 |
2r00101010
|
|
592 |
2r00000000
|
|
593 |
2r10001000
|
|
594 |
2r00000000
|
|
595 |
2r10100010
|
|
596 |
2r00000000]
|
0
|
597 |
!
|
|
598 |
|
|
599 |
dither11in64
|
|
600 |
"return a pattern for dithering"
|
|
601 |
|
2
|
602 |
^ #[2r10001000
|
78
|
603 |
2r00000000
|
|
604 |
2r00101010
|
|
605 |
2r00000000
|
|
606 |
2r10001000
|
|
607 |
2r00000000
|
|
608 |
2r10101010
|
|
609 |
2r00000000]
|
0
|
610 |
!
|
|
611 |
|
|
612 |
dither12in64
|
|
613 |
"return a pattern for dithering"
|
|
614 |
|
2
|
615 |
^ #[2r10001000
|
78
|
616 |
2r00000000
|
|
617 |
2r10101010
|
|
618 |
2r00000000
|
|
619 |
2r10001000
|
|
620 |
2r00000000
|
|
621 |
2r10101010
|
|
622 |
2r00000000]
|
0
|
623 |
!
|
|
624 |
|
|
625 |
dither13in64
|
|
626 |
"return a pattern for dithering"
|
|
627 |
|
2
|
628 |
^ #[2r10001000
|
78
|
629 |
2r00000000
|
|
630 |
2r10101010
|
|
631 |
2r00000000
|
|
632 |
2r10101000
|
|
633 |
2r00000000
|
|
634 |
2r10101010
|
|
635 |
2r00000000]
|
0
|
636 |
!
|
|
637 |
|
|
638 |
dither14in64
|
|
639 |
"return a pattern for dithering"
|
|
640 |
|
2
|
641 |
^ #[2r10001010
|
78
|
642 |
2r00000000
|
|
643 |
2r10101010
|
|
644 |
2r00000000
|
|
645 |
2r10101000
|
|
646 |
2r00000000
|
|
647 |
2r10101010
|
|
648 |
2r00000000]
|
0
|
649 |
!
|
|
650 |
|
|
651 |
dither15in64
|
|
652 |
"return a pattern for dithering"
|
|
653 |
|
2
|
654 |
^ #[2r10001010
|
78
|
655 |
2r00000000
|
|
656 |
2r10101010
|
|
657 |
2r00000000
|
|
658 |
2r10101010
|
|
659 |
2r00000000
|
|
660 |
2r10101010
|
|
661 |
2r00000000]
|
0
|
662 |
!
|
|
663 |
|
|
664 |
dither16in64
|
|
665 |
"return a pattern for dithering"
|
|
666 |
|
2
|
667 |
^ #[2r10101010
|
78
|
668 |
2r00000000
|
|
669 |
2r10101010
|
|
670 |
2r00000000
|
|
671 |
2r10101010
|
|
672 |
2r00000000
|
|
673 |
2r10101010
|
|
674 |
2r00000000]
|
0
|
675 |
!
|
|
676 |
|
|
677 |
dither17in64
|
|
678 |
"return a pattern for dithering"
|
|
679 |
|
2
|
680 |
^ #[2r10101010
|
78
|
681 |
2r01000000
|
|
682 |
2r10101010
|
|
683 |
2r00000000
|
|
684 |
2r10101010
|
|
685 |
2r00000000
|
|
686 |
2r10101010
|
|
687 |
2r00000000]
|
0
|
688 |
!
|
|
689 |
|
|
690 |
dither18in64
|
|
691 |
"return a pattern for dithering"
|
|
692 |
|
2
|
693 |
^ #[2r10101010
|
78
|
694 |
2r01000000
|
|
695 |
2r10101010
|
|
696 |
2r00000000
|
|
697 |
2r10101010
|
|
698 |
2r00000100
|
|
699 |
2r10101010
|
|
700 |
2r00000000]
|
0
|
701 |
!
|
|
702 |
|
|
703 |
dither19in64
|
|
704 |
"return a pattern for dithering"
|
|
705 |
|
2
|
706 |
^ #[2r10101010
|
78
|
707 |
2r01000000
|
|
708 |
2r10101010
|
|
709 |
2r00000000
|
|
710 |
2r10101010
|
|
711 |
2r01000100
|
|
712 |
2r10101010
|
|
713 |
2r00000000]
|
0
|
714 |
!
|
|
715 |
|
|
716 |
dither20in64
|
|
717 |
"return a pattern for dithering"
|
|
718 |
|
2
|
719 |
^ #[2r10101010
|
78
|
720 |
2r01000100
|
|
721 |
2r10101010
|
|
722 |
2r00000000
|
|
723 |
2r10101010
|
|
724 |
2r01000100
|
|
725 |
2r10101010
|
|
726 |
2r00000000]
|
0
|
727 |
!
|
|
728 |
|
|
729 |
dither21in64
|
|
730 |
"return a pattern for dithering"
|
|
731 |
|
2
|
732 |
^ #[2r10101010
|
78
|
733 |
2r01000100
|
|
734 |
2r10101010
|
|
735 |
2r00000000
|
|
736 |
2r10101010
|
|
737 |
2r01000100
|
|
738 |
2r10101010
|
|
739 |
2r00000001]
|
0
|
740 |
!
|
|
741 |
|
|
742 |
dither22in64
|
|
743 |
"return a pattern for dithering"
|
|
744 |
|
2
|
745 |
^ #[2r10101010
|
78
|
746 |
2r01000100
|
|
747 |
2r10101010
|
|
748 |
2r00010000
|
|
749 |
2r10101010
|
|
750 |
2r01000100
|
|
751 |
2r10101010
|
|
752 |
2r00000001]
|
0
|
753 |
!
|
|
754 |
|
|
755 |
dither23in64
|
|
756 |
"return a pattern for dithering"
|
|
757 |
|
2
|
758 |
^ #[2r10101010
|
78
|
759 |
2r01000100
|
|
760 |
2r10101010
|
|
761 |
2r00010001
|
|
762 |
2r10101010
|
|
763 |
2r01000100
|
|
764 |
2r10101010
|
|
765 |
2r00000001]
|
0
|
766 |
!
|
|
767 |
|
|
768 |
dither24in64
|
|
769 |
"return a pattern for dithering"
|
|
770 |
|
2
|
771 |
^ #[2r10101010
|
78
|
772 |
2r01000100
|
|
773 |
2r10101010
|
|
774 |
2r00010001
|
|
775 |
2r10101010
|
|
776 |
2r01000100
|
|
777 |
2r10101010
|
|
778 |
2r00010001]
|
0
|
779 |
!
|
|
780 |
|
|
781 |
dither25in64
|
|
782 |
"return a pattern for dithering"
|
|
783 |
|
2
|
784 |
^ #[2r10101010
|
78
|
785 |
2r01000100
|
|
786 |
2r10101010
|
|
787 |
2r00010001
|
|
788 |
2r10101010
|
|
789 |
2r01000100
|
|
790 |
2r10101010
|
|
791 |
2r01010001]
|
0
|
792 |
!
|
|
793 |
|
|
794 |
dither26in64
|
|
795 |
"return a pattern for dithering"
|
|
796 |
|
2
|
797 |
^ #[2r10101010
|
78
|
798 |
2r01000100
|
|
799 |
2r10101010
|
|
800 |
2r00010101
|
|
801 |
2r10101010
|
|
802 |
2r01000100
|
|
803 |
2r10101010
|
|
804 |
2r01010001]
|
0
|
805 |
!
|
|
806 |
|
|
807 |
dither27in64
|
|
808 |
"return a pattern for dithering"
|
|
809 |
|
2
|
810 |
^ #[2r10101010
|
78
|
811 |
2r01000100
|
|
812 |
2r10101010
|
|
813 |
2r00010101
|
|
814 |
2r10101010
|
|
815 |
2r01000100
|
|
816 |
2r10101010
|
|
817 |
2r01010101]
|
0
|
818 |
!
|
|
819 |
|
|
820 |
dither28in64
|
|
821 |
"return a pattern for dithering"
|
|
822 |
|
2
|
823 |
^ #[2r10101010
|
78
|
824 |
2r01000100
|
|
825 |
2r10101010
|
|
826 |
2r01010101
|
|
827 |
2r10101010
|
|
828 |
2r01000100
|
|
829 |
2r10101010
|
|
830 |
2r01010101]
|
0
|
831 |
!
|
|
832 |
|
|
833 |
dither29in64
|
|
834 |
"return a pattern for dithering"
|
|
835 |
|
2
|
836 |
^ #[2r10101010
|
78
|
837 |
2r01000100
|
|
838 |
2r10101010
|
|
839 |
2r01010101
|
|
840 |
2r10101010
|
|
841 |
2r01010100
|
|
842 |
2r10101010
|
|
843 |
2r01010101]
|
0
|
844 |
!
|
|
845 |
|
|
846 |
dither30in64
|
|
847 |
"return a pattern for dithering"
|
|
848 |
|
2
|
849 |
^ #[2r10101010
|
78
|
850 |
2r01000101
|
|
851 |
2r10101010
|
|
852 |
2r01010101
|
|
853 |
2r10101010
|
|
854 |
2r01010100
|
|
855 |
2r10101010
|
|
856 |
2r01010101]
|
0
|
857 |
!
|
|
858 |
|
|
859 |
dither31in64
|
|
860 |
"return a pattern for dithering"
|
|
861 |
|
2
|
862 |
^ #[2r10101010
|
78
|
863 |
2r01000101
|
|
864 |
2r10101010
|
|
865 |
2r01010101
|
|
866 |
2r10101010
|
|
867 |
2r01010101
|
|
868 |
2r10101010
|
|
869 |
2r01010101]
|
0
|
870 |
!
|
|
871 |
|
|
872 |
dither32in64
|
|
873 |
"return a pattern for dithering"
|
|
874 |
|
2
|
875 |
^ #[2r10101010
|
78
|
876 |
2r01010101
|
|
877 |
2r10101010
|
|
878 |
2r01010101
|
|
879 |
2r10101010
|
|
880 |
2r01010101
|
|
881 |
2r10101010
|
|
882 |
2r01010101]
|
0
|
883 |
!
|
|
884 |
|
26
|
885 |
dither33in64
|
|
886 |
"return a pattern for dithering"
|
|
887 |
|
|
888 |
^ #[2r11101010
|
78
|
889 |
2r01010101
|
|
890 |
2r10101010
|
|
891 |
2r01010101
|
|
892 |
2r10101010
|
|
893 |
2r01010101
|
|
894 |
2r10101010
|
|
895 |
2r01010101]
|
26
|
896 |
!
|
|
897 |
|
|
898 |
dither34in64
|
|
899 |
"return a pattern for dithering"
|
|
900 |
|
|
901 |
^ #[2r11101010
|
78
|
902 |
2r01010101
|
|
903 |
2r10101010
|
|
904 |
2r01010101
|
|
905 |
2r10101110
|
|
906 |
2r01010101
|
|
907 |
2r10101010
|
|
908 |
2r01010101]
|
26
|
909 |
!
|
|
910 |
|
|
911 |
dither35in64
|
|
912 |
"return a pattern for dithering"
|
|
913 |
|
|
914 |
^ #[2r11101010
|
78
|
915 |
2r01010101
|
|
916 |
2r10101010
|
|
917 |
2r01010101
|
|
918 |
2r11101110
|
|
919 |
2r01010101
|
|
920 |
2r10101010
|
|
921 |
2r01010101]
|
26
|
922 |
!
|
|
923 |
|
|
924 |
dither36in64
|
|
925 |
"return a pattern for dithering"
|
|
926 |
|
|
927 |
^ #[2r11101110
|
78
|
928 |
2r01010101
|
|
929 |
2r10101010
|
|
930 |
2r01010101
|
|
931 |
2r11101110
|
|
932 |
2r01010101
|
|
933 |
2r10101010
|
|
934 |
2r01010101]
|
26
|
935 |
!
|
|
936 |
|
|
937 |
dither37in64
|
|
938 |
"return a pattern for dithering"
|
|
939 |
|
|
940 |
^ #[2r11101110
|
78
|
941 |
2r01010101
|
|
942 |
2r10101010
|
|
943 |
2r01010101
|
|
944 |
2r11101110
|
|
945 |
2r01010101
|
|
946 |
2r10101011
|
|
947 |
2r01010101]
|
26
|
948 |
!
|
|
949 |
|
|
950 |
dither38in64
|
|
951 |
"return a pattern for dithering"
|
|
952 |
|
|
953 |
^ #[2r11101110
|
78
|
954 |
2r01010101
|
|
955 |
2r10111010
|
|
956 |
2r01010101
|
|
957 |
2r11101110
|
|
958 |
2r01010101
|
|
959 |
2r10101011
|
|
960 |
2r01010101]
|
26
|
961 |
!
|
|
962 |
|
|
963 |
dither39in64
|
|
964 |
"return a pattern for dithering"
|
|
965 |
|
|
966 |
^ #[2r11101110
|
78
|
967 |
2r01010101
|
|
968 |
2r10111011
|
|
969 |
2r01010101
|
|
970 |
2r11101110
|
|
971 |
2r01010101
|
|
972 |
2r10101011
|
|
973 |
2r01010101]
|
26
|
974 |
!
|
|
975 |
|
|
976 |
dither40in64
|
|
977 |
"return a pattern for dithering"
|
|
978 |
|
|
979 |
^ #[2r11101110
|
78
|
980 |
2r01010101
|
|
981 |
2r10111011
|
|
982 |
2r01010101
|
|
983 |
2r11101110
|
|
984 |
2r01010101
|
|
985 |
2r10111011
|
|
986 |
2r01010101]
|
26
|
987 |
!
|
|
988 |
|
|
989 |
dither41in64
|
|
990 |
"return a pattern for dithering"
|
|
991 |
|
|
992 |
^ #[2r11101110
|
78
|
993 |
2r01010101
|
|
994 |
2r10111011
|
|
995 |
2r01010101
|
|
996 |
2r11101110
|
|
997 |
2r01010101
|
|
998 |
2r11111011
|
|
999 |
2r01010101]
|
26
|
1000 |
!
|
|
1001 |
|
|
1002 |
dither42in64
|
|
1003 |
"return a pattern for dithering"
|
|
1004 |
|
|
1005 |
^ #[2r11101110
|
78
|
1006 |
2r01010101
|
|
1007 |
2r10111111
|
|
1008 |
2r01010101
|
|
1009 |
2r11101110
|
|
1010 |
2r01010101
|
|
1011 |
2r11111011
|
|
1012 |
2r01010101]
|
26
|
1013 |
!
|
|
1014 |
|
|
1015 |
dither43in64
|
|
1016 |
"return a pattern for dithering"
|
|
1017 |
|
|
1018 |
^ #[2r11101110
|
78
|
1019 |
2r01010101
|
|
1020 |
2r10111111
|
|
1021 |
2r01010101
|
|
1022 |
2r11101110
|
|
1023 |
2r01010101
|
|
1024 |
2r11111111
|
|
1025 |
2r01010101]
|
26
|
1026 |
!
|
|
1027 |
|
|
1028 |
dither44in64
|
|
1029 |
"return a pattern for dithering"
|
|
1030 |
|
|
1031 |
^ #[2r11101110
|
78
|
1032 |
2r01010101
|
|
1033 |
2r11111111
|
|
1034 |
2r01010101
|
|
1035 |
2r11101110
|
|
1036 |
2r01010101
|
|
1037 |
2r11111111
|
|
1038 |
2r01010101]
|
26
|
1039 |
!
|
|
1040 |
|
|
1041 |
dither45in64
|
|
1042 |
"return a pattern for dithering"
|
|
1043 |
|
|
1044 |
^ #[2r11101110
|
78
|
1045 |
2r01010101
|
|
1046 |
2r11111111
|
|
1047 |
2r01010101
|
|
1048 |
2r11111110
|
|
1049 |
2r01010101
|
|
1050 |
2r11111111
|
|
1051 |
2r01010101]
|
26
|
1052 |
!
|
|
1053 |
|
|
1054 |
dither46in64
|
|
1055 |
"return a pattern for dithering"
|
|
1056 |
|
|
1057 |
^ #[2r11101111
|
78
|
1058 |
2r01010101
|
|
1059 |
2r11111111
|
|
1060 |
2r01010101
|
|
1061 |
2r11111110
|
|
1062 |
2r01010101
|
|
1063 |
2r11111111
|
|
1064 |
2r01010101]
|
26
|
1065 |
!
|
|
1066 |
|
|
1067 |
dither47in64
|
|
1068 |
"return a pattern for dithering"
|
|
1069 |
|
|
1070 |
^ #[2r11101111
|
78
|
1071 |
2r01010101
|
|
1072 |
2r11111111
|
|
1073 |
2r01010101
|
|
1074 |
2r11111111
|
|
1075 |
2r01010101
|
|
1076 |
2r11111111
|
|
1077 |
2r01010101]
|
26
|
1078 |
!
|
|
1079 |
|
|
1080 |
dither48in64
|
|
1081 |
"return a pattern for dithering"
|
|
1082 |
|
|
1083 |
^ #[2r11111111
|
78
|
1084 |
2r01010101
|
|
1085 |
2r11111111
|
|
1086 |
2r01010101
|
|
1087 |
2r11111111
|
|
1088 |
2r01010101
|
|
1089 |
2r11111111
|
|
1090 |
2r01010101]
|
26
|
1091 |
!
|
|
1092 |
|
|
1093 |
dither49in64
|
|
1094 |
"return a pattern for dithering"
|
|
1095 |
|
|
1096 |
^ #[2r11111111
|
78
|
1097 |
2r01110101
|
|
1098 |
2r11111111
|
|
1099 |
2r01010101
|
|
1100 |
2r11111111
|
|
1101 |
2r01010101
|
|
1102 |
2r11111111
|
|
1103 |
2r01010101]
|
26
|
1104 |
!
|
|
1105 |
|
|
1106 |
dither50in64
|
|
1107 |
"return a pattern for dithering"
|
|
1108 |
|
|
1109 |
^ #[2r11111111
|
78
|
1110 |
2r01110101
|
|
1111 |
2r11111111
|
|
1112 |
2r01010101
|
|
1113 |
2r11111111
|
|
1114 |
2r01010111
|
|
1115 |
2r11111111
|
|
1116 |
2r01010101]
|
26
|
1117 |
!
|
|
1118 |
|
|
1119 |
dither51in64
|
|
1120 |
"return a pattern for dithering"
|
|
1121 |
|
|
1122 |
^ #[2r11111111
|
78
|
1123 |
2r01110101
|
|
1124 |
2r11111111
|
|
1125 |
2r01010101
|
|
1126 |
2r11111111
|
|
1127 |
2r01110111
|
|
1128 |
2r11111111
|
|
1129 |
2r01010101]
|
26
|
1130 |
!
|
|
1131 |
|
|
1132 |
dither52in64
|
|
1133 |
"return a pattern for dithering"
|
|
1134 |
|
|
1135 |
^ #[2r11111111
|
78
|
1136 |
2r01110111
|
|
1137 |
2r11111111
|
|
1138 |
2r01010101
|
|
1139 |
2r11111111
|
|
1140 |
2r01110111
|
|
1141 |
2r11111111
|
|
1142 |
2r01010101]
|
26
|
1143 |
!
|
|
1144 |
|
|
1145 |
dither53in64
|
|
1146 |
"return a pattern for dithering"
|
|
1147 |
|
|
1148 |
^ #[2r11111111
|
78
|
1149 |
2r01110111
|
|
1150 |
2r11111111
|
|
1151 |
2r01010101
|
|
1152 |
2r11111111
|
|
1153 |
2r01110111
|
|
1154 |
2r11111111
|
|
1155 |
2r11010101]
|
26
|
1156 |
!
|
|
1157 |
|
|
1158 |
dither54in64
|
|
1159 |
"return a pattern for dithering"
|
|
1160 |
|
|
1161 |
^ #[2r11111111
|
78
|
1162 |
2r01110111
|
|
1163 |
2r11111111
|
|
1164 |
2r01011101
|
|
1165 |
2r11111111
|
|
1166 |
2r01110111
|
|
1167 |
2r11111111
|
|
1168 |
2r11010101]
|
26
|
1169 |
!
|
|
1170 |
|
|
1171 |
dither55in64
|
|
1172 |
"return a pattern for dithering"
|
|
1173 |
|
|
1174 |
^ #[2r11111111
|
78
|
1175 |
2r01110111
|
|
1176 |
2r11111111
|
|
1177 |
2r11011101
|
|
1178 |
2r11111111
|
|
1179 |
2r01110111
|
|
1180 |
2r11111111
|
|
1181 |
2r11010101]
|
26
|
1182 |
!
|
|
1183 |
|
|
1184 |
dither56in64
|
|
1185 |
"return a pattern for dithering"
|
|
1186 |
|
|
1187 |
^ #[2r11111111
|
78
|
1188 |
2r01110111
|
|
1189 |
2r11111111
|
|
1190 |
2r11011101
|
|
1191 |
2r11111111
|
|
1192 |
2r01110111
|
|
1193 |
2r11111111
|
|
1194 |
2r11011101]
|
26
|
1195 |
!
|
|
1196 |
|
|
1197 |
dither57in64
|
|
1198 |
"return a pattern for dithering"
|
|
1199 |
|
|
1200 |
^ #[2r11111111
|
78
|
1201 |
2r01110111
|
|
1202 |
2r11111111
|
|
1203 |
2r11011101
|
|
1204 |
2r11111111
|
|
1205 |
2r01110111
|
|
1206 |
2r11111111
|
|
1207 |
2r11111101]
|
26
|
1208 |
!
|
|
1209 |
|
|
1210 |
dither58in64
|
|
1211 |
"return a pattern for dithering"
|
|
1212 |
|
|
1213 |
^ #[2r11111111
|
78
|
1214 |
2r01110111
|
|
1215 |
2r11111111
|
|
1216 |
2r11011111
|
|
1217 |
2r11111111
|
|
1218 |
2r01110111
|
|
1219 |
2r11111111
|
|
1220 |
2r11111101]
|
26
|
1221 |
!
|
|
1222 |
|
|
1223 |
dither59in64
|
|
1224 |
"return a pattern for dithering"
|
|
1225 |
|
|
1226 |
^ #[2r11111111
|
78
|
1227 |
2r01110111
|
|
1228 |
2r11111111
|
|
1229 |
2r11011111
|
|
1230 |
2r11111111
|
|
1231 |
2r01110111
|
|
1232 |
2r11111111
|
|
1233 |
2r11111111]
|
26
|
1234 |
!
|
|
1235 |
|
|
1236 |
dither60in64
|
|
1237 |
"return a pattern for dithering"
|
|
1238 |
|
|
1239 |
^ #[2r11111111
|
78
|
1240 |
2r01110111
|
|
1241 |
2r11111111
|
|
1242 |
2r11111111
|
|
1243 |
2r11111111
|
|
1244 |
2r01110111
|
|
1245 |
2r11111111
|
|
1246 |
2r11111111]
|
26
|
1247 |
!
|
|
1248 |
|
|
1249 |
dither61in64
|
|
1250 |
"return a pattern for dithering"
|
|
1251 |
|
|
1252 |
^ #[2r11111111
|
78
|
1253 |
2r01110111
|
|
1254 |
2r11111111
|
|
1255 |
2r11111111
|
|
1256 |
2r11111111
|
|
1257 |
2r01111111
|
|
1258 |
2r11111111
|
|
1259 |
2r11111111]
|
26
|
1260 |
!
|
|
1261 |
|
|
1262 |
dither62in64
|
|
1263 |
"return a pattern for dithering"
|
|
1264 |
|
|
1265 |
^ #[2r11111111
|
78
|
1266 |
2r11110111
|
|
1267 |
2r11111111
|
|
1268 |
2r11111111
|
|
1269 |
2r11111111
|
|
1270 |
2r01111111
|
|
1271 |
2r11111111
|
|
1272 |
2r11111111]
|
26
|
1273 |
!
|
|
1274 |
|
|
1275 |
dither63in64
|
|
1276 |
"return a pattern for dithering"
|
|
1277 |
|
|
1278 |
^ #[2r11111111
|
78
|
1279 |
2r11110111
|
|
1280 |
2r11111111
|
|
1281 |
2r11111111
|
|
1282 |
2r11111111
|
|
1283 |
2r11111111
|
|
1284 |
2r11111111
|
|
1285 |
2r11111111]
|
26
|
1286 |
!
|
|
1287 |
|
0
|
1288 |
grey6Bits
|
|
1289 |
"return a pattern with 6% grey, usable for dithering"
|
|
1290 |
|
|
1291 |
^ #(2r00000001
|
78
|
1292 |
2r00000000
|
|
1293 |
2r00010000
|
|
1294 |
2r00000000)
|
0
|
1295 |
!
|
|
1296 |
|
|
1297 |
grey12Bits
|
|
1298 |
"return a pattern with 12% grey, usable for dithering"
|
|
1299 |
|
|
1300 |
^ #(2r00010001
|
78
|
1301 |
2r00000000
|
|
1302 |
2r01000100
|
|
1303 |
2r00000000)
|
0
|
1304 |
!
|
|
1305 |
|
|
1306 |
grey25Bits
|
|
1307 |
"return a pattern with 25% grey, usable for dithering"
|
|
1308 |
|
|
1309 |
^ #(2r00010001
|
78
|
1310 |
2r01000100
|
|
1311 |
2r00010001
|
|
1312 |
2r01000100)
|
0
|
1313 |
!
|
|
1314 |
|
|
1315 |
grey37Bits
|
|
1316 |
"return a pattern with 37% grey, usable for dithering"
|
|
1317 |
|
|
1318 |
^ #(2r00010001
|
78
|
1319 |
2r10101010
|
|
1320 |
2r01000100
|
|
1321 |
2r10101010)
|
0
|
1322 |
!
|
|
1323 |
|
|
1324 |
grey50Bits
|
|
1325 |
"return a pattern with 50% grey, usable for dithering"
|
|
1326 |
|
|
1327 |
^ #(2r01010101
|
78
|
1328 |
2r10101010
|
|
1329 |
2r01010101
|
|
1330 |
2r10101010)
|
0
|
1331 |
!
|
|
1332 |
|
|
1333 |
veryLightGreyFormBits
|
|
1334 |
"return a pattern usable to simulate veryDarkGray on monochrome device"
|
|
1335 |
|
|
1336 |
^ #(2r10001000
|
78
|
1337 |
2r00000000
|
|
1338 |
2r00100010
|
|
1339 |
2r00000000)
|
0
|
1340 |
!
|
|
1341 |
|
|
1342 |
lightGreyFormBits
|
|
1343 |
"return a pattern usable to simulate lightGray on monochrome device"
|
|
1344 |
|
|
1345 |
^ #(2r01000100
|
78
|
1346 |
2r00010001
|
|
1347 |
2r01000100
|
|
1348 |
2r00010001
|
|
1349 |
2r01000100)
|
0
|
1350 |
!
|
|
1351 |
|
|
1352 |
greyFormBits
|
|
1353 |
"return a pattern usable to simulate gray on monochrome device"
|
|
1354 |
|
|
1355 |
^ #(2r01010101
|
78
|
1356 |
2r10101010
|
|
1357 |
2r01010101
|
|
1358 |
2r10101010)
|
0
|
1359 |
!
|
|
1360 |
|
|
1361 |
darkGreyFormBits
|
|
1362 |
"return a pattern usable to simulate darkGray on monochrome device"
|
|
1363 |
|
|
1364 |
^ #(2r10111011
|
78
|
1365 |
2r11101110
|
|
1366 |
2r10111011
|
|
1367 |
2r11101110)
|
0
|
1368 |
!
|
|
1369 |
|
|
1370 |
veryDarkGreyFormBits
|
|
1371 |
"return a pattern usable to simulate veryDarkGray on monochrome device"
|
|
1372 |
|
|
1373 |
^ #(2r01110111
|
78
|
1374 |
2r11111111
|
|
1375 |
2r11011101
|
|
1376 |
2r11111111)
|
0
|
1377 |
! !
|
|
1378 |
|
|
1379 |
!Form methodsFor:'initialization'!
|
|
1380 |
|
|
1381 |
initialize
|
|
1382 |
super initialize.
|
|
1383 |
depth := 1.
|
78
|
1384 |
foreground := paint := Color colorId:1.
|
|
1385 |
background := bgPaint := Color colorId:0
|
0
|
1386 |
!
|
|
1387 |
|
|
1388 |
initGC
|
|
1389 |
"stop server from sending exposure events for Forms -
|
|
1390 |
(will fill up stream-queue on some stupid (i.e. sco) systems"
|
|
1391 |
|
126
|
1392 |
super initGC.
|
|
1393 |
"/ self createGC.
|
|
1394 |
"/ Lobby changed:self.
|
0
|
1395 |
self setGraphicsExposures:false
|
|
1396 |
!
|
|
1397 |
|
|
1398 |
recreate
|
|
1399 |
"reconstruct the form after a snapin"
|
|
1400 |
|
|
1401 |
data notNil ifTrue:[
|
118
|
1402 |
"
|
|
1403 |
create one from data
|
|
1404 |
"
|
78
|
1405 |
(depth == 1 or:[depth == device depth]) ifTrue:[
|
|
1406 |
drawableId := device createBitmapFromArray:data width:width height:height.
|
118
|
1407 |
Lobby changed:self.
|
78
|
1408 |
^ self
|
|
1409 |
].
|
|
1410 |
data := nil.
|
0
|
1411 |
].
|
|
1412 |
fileName notNil ifTrue:[
|
118
|
1413 |
"
|
|
1414 |
create one from a file (mhmh - this seems X-specific and will vanish)
|
|
1415 |
"
|
78
|
1416 |
drawableId := device createBitmapFromFile:fileName for:self.
|
118
|
1417 |
Lobby changed:self.
|
78
|
1418 |
^ self
|
0
|
1419 |
].
|
118
|
1420 |
'FORM: cannot recreate form' errorPrintNL.
|
|
1421 |
"
|
|
1422 |
create an empty one
|
|
1423 |
"
|
0
|
1424 |
depth == 1 ifTrue:[
|
78
|
1425 |
drawableId := device createBitmapWidth:width height:height
|
0
|
1426 |
] ifFalse:[
|
78
|
1427 |
drawableId := device createPixmapWidth:width height:height depth:device depth
|
118
|
1428 |
].
|
|
1429 |
Lobby changed:self
|
2
|
1430 |
! !
|
|
1431 |
|
|
1432 |
!Form methodsFor:'binary storage'!
|
|
1433 |
|
127
|
1434 |
storeBinaryDefinitionOn: stream manager: manager
|
|
1435 |
"store a binary representation of the receiver on stream.
|
|
1436 |
Redefined to store the actual bits, even if I have been loaded
|
|
1437 |
from a file."
|
|
1438 |
|
|
1439 |
data isNil ifTrue:[
|
|
1440 |
data := self bits.
|
|
1441 |
super storeBinaryDefinitionOn: stream manager: manager.
|
|
1442 |
data := nil.
|
|
1443 |
^ self
|
|
1444 |
].
|
|
1445 |
super storeBinaryDefinitionOn: stream manager: manager
|
|
1446 |
!
|
|
1447 |
|
2
|
1448 |
readBinaryContentsFrom: stream manager: manager
|
|
1449 |
"tell the newly restored Form about restoration"
|
|
1450 |
|
|
1451 |
super readBinaryContentsFrom: stream manager: manager.
|
127
|
1452 |
device := Display.
|
|
1453 |
fileName := nil.
|
2
|
1454 |
self restored.
|
127
|
1455 |
self recreate.
|
126
|
1456 |
Lobby register:self.
|
127
|
1457 |
|
|
1458 |
"
|
|
1459 |
|f|
|
|
1460 |
|
|
1461 |
f := Form fromFile:'bitmaps/SBrowser.xbm'.
|
|
1462 |
f storeBinaryOn:'foo.bos'.
|
|
1463 |
|
|
1464 |
(Form readBinaryFrom:'foo.bos') inspect
|
|
1465 |
"
|
2
|
1466 |
! !
|
|
1467 |
|
0
|
1468 |
!Form methodsFor:'getting a device form'!
|
|
1469 |
|
|
1470 |
on:aDevice
|
|
1471 |
aDevice == device ifTrue:[
|
78
|
1472 |
^ self
|
0
|
1473 |
].
|
133
|
1474 |
"create a new form ..."
|
|
1475 |
|
|
1476 |
data notNil ifTrue:[
|
|
1477 |
^ self class width:width height:height fromArray:data on:aDevice
|
|
1478 |
].
|
|
1479 |
fileName notNil ifTrue:[
|
|
1480 |
^ self class fromFile:fileName on:aDevice
|
|
1481 |
].
|
|
1482 |
^ self width:width height:height on:aDevice
|
0
|
1483 |
!
|
|
1484 |
|
|
1485 |
asMonochromeFormOn:aDevice
|
|
1486 |
aDevice == device ifTrue:[
|
78
|
1487 |
depth == 1 ifTrue:[
|
|
1488 |
^ self
|
|
1489 |
].
|
0
|
1490 |
].
|
133
|
1491 |
(depth == 1) ifTrue:[
|
|
1492 |
^ self on:aDevice
|
|
1493 |
].
|
0
|
1494 |
^ nil
|
35
|
1495 |
!
|
|
1496 |
|
|
1497 |
asFormOn:aDevice
|
|
1498 |
aDevice == device ifTrue:[
|
78
|
1499 |
^ self
|
35
|
1500 |
].
|
133
|
1501 |
^ self on:aDevice
|
0
|
1502 |
! !
|
|
1503 |
|
107
|
1504 |
!Form methodsFor:'converting'!
|
|
1505 |
|
|
1506 |
asForm
|
|
1507 |
^ self
|
|
1508 |
!
|
|
1509 |
|
|
1510 |
asImage
|
|
1511 |
^ Image fromForm:self
|
|
1512 |
! !
|
|
1513 |
|
0
|
1514 |
!Form methodsFor:'private'!
|
|
1515 |
|
2
|
1516 |
restored
|
54
|
1517 |
"flush device data, when restored
|
|
1518 |
(sent after snapin or binaryLoad)"
|
|
1519 |
|
0
|
1520 |
drawableId := nil.
|
|
1521 |
gcId := nil.
|
|
1522 |
!
|
|
1523 |
|
54
|
1524 |
getBits
|
|
1525 |
"if the receiver was not created from a file, or
|
|
1526 |
an array (i.e. it was drawn), read the pixels from the
|
|
1527 |
device into a local data array. This has to be done before
|
|
1528 |
an image is saved, or the receiver is storedBinary, since
|
|
1529 |
the information present in the device is lost after restart/reload"
|
|
1530 |
|
|
1531 |
(data isNil and:[fileName isNil]) ifTrue:[
|
78
|
1532 |
data := self bits
|
54
|
1533 |
]
|
|
1534 |
!
|
|
1535 |
|
0
|
1536 |
width:w height:h
|
54
|
1537 |
"actual create of a monochrome form"
|
0
|
1538 |
|
|
1539 |
((w == 0) or:[h == 0]) ifTrue:[
|
78
|
1540 |
self error:'invalid form extent'.
|
|
1541 |
^ nil
|
0
|
1542 |
].
|
|
1543 |
width := w.
|
|
1544 |
height := h.
|
54
|
1545 |
depth := 1.
|
0
|
1546 |
offset := 0@0.
|
|
1547 |
drawableId := device createBitmapWidth:w height:h.
|
|
1548 |
drawableId isNil ifTrue:[^ nil].
|
|
1549 |
BlackAndWhiteColorMap isNil ifTrue:[
|
78
|
1550 |
BlackAndWhiteColorMap := Array with:(Color white) with:(Color black)
|
0
|
1551 |
].
|
|
1552 |
localColorMap := BlackAndWhiteColorMap.
|
|
1553 |
realized := true.
|
126
|
1554 |
Lobby changed:self.
|
0
|
1555 |
!
|
|
1556 |
|
|
1557 |
width:w height:h depth:d
|
54
|
1558 |
"actual create of an arbitrary deep form (but, must be supported by device)"
|
0
|
1559 |
|
|
1560 |
width := w.
|
|
1561 |
height := h.
|
|
1562 |
offset := 0@0.
|
|
1563 |
drawableId := device createPixmapWidth:w height:h depth:d.
|
|
1564 |
drawableId isNil ifTrue:[^ nil].
|
|
1565 |
realized := true.
|
|
1566 |
depth := d.
|
126
|
1567 |
Lobby changed:self.
|
0
|
1568 |
!
|
|
1569 |
|
|
1570 |
width:w height:h fromArray:anArray
|
54
|
1571 |
"actual create of a monochrome form from array.
|
0
|
1572 |
This method is somewhat more complicated as it should be due to
|
|
1573 |
supporting both byte-wise (ST/X-type) and short-word-wise (ST-80-type)
|
|
1574 |
Arrays; in the later case, the shorts are first converted to bytes in
|
|
1575 |
a ByteArray, then passed to the device."
|
|
1576 |
|
134
|
1577 |
|bytes bits
|
|
1578 |
srcPerRow "{ Class: SmallInteger }"
|
|
1579 |
dstPerRow "{ Class: SmallInteger }"
|
|
1580 |
srcStart "{ Class: SmallInteger }"
|
|
1581 |
srcIndex "{ Class: SmallInteger }"
|
|
1582 |
dstIndex "{ Class: SmallInteger }"
|
|
1583 |
hi "{ Class: SmallInteger }" |
|
0
|
1584 |
|
|
1585 |
bytes := anArray.
|
|
1586 |
|
|
1587 |
anArray size ~~ (((w + 7) // 8) * h) ifTrue:[
|
78
|
1588 |
anArray size == (((w + 15) // 16) * h) ifTrue:[
|
|
1589 |
"I want the bytes but got shorts (ST-80)"
|
|
1590 |
bytes := ByteArray uninitializedNew:(((w + 7) // 8) * h).
|
|
1591 |
srcPerRow := (w + 15) // 16.
|
|
1592 |
dstPerRow := (w + 7) // 8.
|
|
1593 |
srcStart := 1.
|
|
1594 |
dstIndex := 1.
|
134
|
1595 |
hi := h.
|
|
1596 |
1 to:hi do:[:hi |
|
78
|
1597 |
srcIndex := srcStart.
|
|
1598 |
bits := anArray at:srcIndex.
|
|
1599 |
1 to:dstPerRow do:[:di |
|
|
1600 |
di odd ifTrue:[
|
|
1601 |
bits := anArray at:srcIndex.
|
|
1602 |
bytes at:dstIndex put:(bits bitShift:-8)
|
|
1603 |
] ifFalse:[
|
|
1604 |
bytes at:dstIndex put:(bits bitAnd:16rFF).
|
|
1605 |
srcIndex := srcIndex + 1
|
|
1606 |
].
|
|
1607 |
dstIndex := dstIndex + 1
|
|
1608 |
].
|
|
1609 |
srcStart := srcStart + srcPerRow
|
|
1610 |
]
|
|
1611 |
]
|
0
|
1612 |
].
|
|
1613 |
width := w.
|
|
1614 |
height := h.
|
54
|
1615 |
depth := 1.
|
0
|
1616 |
offset := 0@0.
|
|
1617 |
drawableId := device createBitmapFromArray:bytes width:w height:h.
|
|
1618 |
drawableId isNil ifTrue:[^ nil].
|
|
1619 |
|
|
1620 |
data := bytes.
|
|
1621 |
BlackAndWhiteColorMap isNil ifTrue:[
|
78
|
1622 |
BlackAndWhiteColorMap := Array with:(Color white) with:(Color black)
|
0
|
1623 |
].
|
|
1624 |
localColorMap := BlackAndWhiteColorMap.
|
|
1625 |
realized := true.
|
126
|
1626 |
Lobby changed:self.
|
0
|
1627 |
!
|
|
1628 |
|
|
1629 |
width:w height:h offset:offs fromArray:anArray
|
54
|
1630 |
"actual create of a monochrome form from array"
|
0
|
1631 |
|
|
1632 |
self width:w height:h fromArray:anArray.
|
|
1633 |
offset := offs
|
|
1634 |
!
|
|
1635 |
|
|
1636 |
readFromFile:filename
|
54
|
1637 |
"read a monochrome form from a file (in xbm-format)"
|
0
|
1638 |
|
|
1639 |
|pathName|
|
|
1640 |
|
|
1641 |
pathName := self class findBitmapFile:filename.
|
|
1642 |
pathName notNil ifTrue:[
|
78
|
1643 |
drawableId := device createBitmapFromFile:pathName for:self.
|
|
1644 |
drawableId isNil ifTrue:[^ nil].
|
0
|
1645 |
|
78
|
1646 |
fileName := pathName.
|
|
1647 |
offset := 0@0.
|
|
1648 |
realized := true.
|
|
1649 |
BlackAndWhiteColorMap isNil ifTrue:[
|
|
1650 |
BlackAndWhiteColorMap := Array with:(Color white) with:(Color black)
|
|
1651 |
].
|
|
1652 |
localColorMap := BlackAndWhiteColorMap.
|
126
|
1653 |
Lobby changed:self.
|
78
|
1654 |
^ self
|
0
|
1655 |
].
|
|
1656 |
^ nil
|
|
1657 |
!
|
|
1658 |
|
|
1659 |
readFromFile:filename resolution:dpi
|
54
|
1660 |
"read a monochrome form from a file, which is assumed to have data for a dpi-resolution;
|
|
1661 |
if the actual resolution of the device differs, magnify the form."
|
0
|
1662 |
|
151
|
1663 |
|dpiH mag dev|
|
0
|
1664 |
|
|
1665 |
(self readFromFile:filename) isNil ifTrue:[^ nil].
|
|
1666 |
|
|
1667 |
"if the device is within +- 50% of dpi, no magnify is needed"
|
151
|
1668 |
dev := device.
|
|
1669 |
dev isNil ifTrue:[
|
|
1670 |
"should not happen ..."
|
|
1671 |
dev := Display
|
|
1672 |
].
|
|
1673 |
dpiH := dev horizontalPixelPerInch.
|
0
|
1674 |
((dpi >= (dpiH * 0.75)) and:[dpi <= (dpiH * 1.5)]) ifTrue:[^ self].
|
|
1675 |
mag := (dpiH / dpi) rounded.
|
|
1676 |
mag == 0 ifTrue:[
|
78
|
1677 |
^ self
|
0
|
1678 |
].
|
134
|
1679 |
^ self magnifiedBy:(mag @ mag)
|
0
|
1680 |
|
|
1681 |
"Form fromFile:'SBrowser.icn' resolution:50"
|
|
1682 |
! !
|
|
1683 |
|
|
1684 |
!Form methodsFor:'ST-80 compatibility'!
|
|
1685 |
|
|
1686 |
offset:org
|
|
1687 |
"set the offset.
|
|
1688 |
Smalltalk-80 compatibility"
|
|
1689 |
|
|
1690 |
offset := org
|
|
1691 |
!
|
|
1692 |
|
|
1693 |
offset
|
|
1694 |
"set the offset.
|
|
1695 |
Smalltalk-80 compatibility"
|
|
1696 |
|
|
1697 |
^ offset
|
|
1698 |
!
|
|
1699 |
|
89
|
1700 |
displayOn:aGC rule:rule
|
|
1701 |
"draw in aGC.
|
|
1702 |
Smalltalk-80 (2.x) compatibility"
|
|
1703 |
|
|
1704 |
^ self displayOn:aGC at:0@0 rule:rule
|
|
1705 |
!
|
|
1706 |
|
98
|
1707 |
displayOn:aGC at:aPoint
|
|
1708 |
"draw in aGC.
|
|
1709 |
Smalltalk-80 (2.x) compatibility"
|
|
1710 |
|
|
1711 |
^ self displayOn:aGC at:aPoint rule:#copy
|
|
1712 |
!
|
|
1713 |
|
89
|
1714 |
displayOn:aGC at:aPoint rule:rule
|
|
1715 |
"draw in aGC.
|
|
1716 |
Smalltalk-80 (2.x) compatibility"
|
|
1717 |
|
|
1718 |
|f|
|
|
1719 |
|
|
1720 |
f := aGC function.
|
|
1721 |
aGC function:rule.
|
|
1722 |
aGC displayOpaqueForm:self x:aPoint x y:aPoint y.
|
|
1723 |
aGC function:f.
|
0
|
1724 |
! !
|
|
1725 |
|
|
1726 |
!Form methodsFor:'accessing'!
|
|
1727 |
|
98
|
1728 |
valueAt:aPoint
|
|
1729 |
^ self at:aPoint
|
|
1730 |
!
|
|
1731 |
|
|
1732 |
valueAt:aPoint put:value
|
|
1733 |
^ self at:aPoint put:value
|
|
1734 |
!
|
|
1735 |
|
0
|
1736 |
colorMap
|
54
|
1737 |
"return the receivers colormap"
|
0
|
1738 |
|
|
1739 |
^ localColorMap
|
|
1740 |
!
|
|
1741 |
|
|
1742 |
colorMap:anArray
|
54
|
1743 |
"set the receivers colormap"
|
0
|
1744 |
|
|
1745 |
localColorMap := anArray
|
|
1746 |
!
|
|
1747 |
|
|
1748 |
depth
|
54
|
1749 |
"return the receivers depth"
|
0
|
1750 |
|
|
1751 |
^ depth
|
|
1752 |
!
|
|
1753 |
|
|
1754 |
bits
|
|
1755 |
"return a ByteArray filled with my bits -
|
|
1756 |
for depth 8 forms, 1 pixel/byte is filled;
|
2
|
1757 |
for depth 1 forms, 8 pixels/byte are filled
|
54
|
1758 |
for depth 4 forms, 2 pixels/byte are filled.
|
|
1759 |
Padding is done to the next byte-boundary
|
71
|
1760 |
(i.e. for width==13 and depth==1 it will return 2 bytes per scanline)"
|
2
|
1761 |
|
134
|
1762 |
|bytesPerLine "{ Class: SmallInteger }"
|
|
1763 |
bytesPerLineIn "{ Class: SmallInteger }"
|
54
|
1764 |
inData tmpData info
|
|
1765 |
srcIndex "{ Class: SmallInteger }"
|
86
|
1766 |
dstIndex "{ Class: SmallInteger }"
|
|
1767 |
buffer|
|
0
|
1768 |
|
2
|
1769 |
data notNil ifTrue:[
|
78
|
1770 |
^ data
|
2
|
1771 |
].
|
|
1772 |
drawableId isNil ifTrue:[
|
78
|
1773 |
fileName notNil ifTrue:[
|
|
1774 |
^ (self on:Display) bits
|
|
1775 |
].
|
|
1776 |
^ nil
|
2
|
1777 |
].
|
|
1778 |
|
54
|
1779 |
bytesPerLine := (width * depth + 31) // 32 * 4.
|
|
1780 |
inData := ByteArray uninitializedNew:(bytesPerLine * height).
|
|
1781 |
info := device getBitsFrom:drawableId x:0 y:0 width:width height:height into:inData.
|
|
1782 |
bytesPerLineIn := (info at:3). "what I got"
|
71
|
1783 |
bytesPerLine := (width * depth + 7) // 8. "what I want"
|
54
|
1784 |
(bytesPerLine ~~ bytesPerLineIn) ifTrue:[
|
71
|
1785 |
"
|
|
1786 |
different padding - have to copy over row-wise
|
|
1787 |
"
|
78
|
1788 |
tmpData := inData.
|
|
1789 |
inData := ByteArray uninitializedNew:(bytesPerLine * height).
|
|
1790 |
srcIndex := 1.
|
|
1791 |
dstIndex := 1.
|
|
1792 |
1 to:height do:[:hi |
|
|
1793 |
inData replaceFrom:dstIndex to:(dstIndex + bytesPerLine - 1)
|
|
1794 |
with:tmpData startingAt:srcIndex.
|
|
1795 |
dstIndex := dstIndex + bytesPerLine.
|
|
1796 |
srcIndex := srcIndex + bytesPerLineIn
|
|
1797 |
]
|
0
|
1798 |
] ifFalse:[
|
71
|
1799 |
"
|
|
1800 |
same padding - copy over all in one chunk
|
|
1801 |
"
|
78
|
1802 |
(bytesPerLine * height) ~~ inData size ifTrue:[
|
|
1803 |
tmpData := inData.
|
|
1804 |
inData := ByteArray uninitializedNew:(bytesPerLine * height).
|
|
1805 |
inData replaceFrom:1 to:bytesPerLine * height with:tmpData startingAt:1
|
|
1806 |
]
|
0
|
1807 |
].
|
86
|
1808 |
"
|
|
1809 |
have to reverse bytes, if not msbFirst ?
|
|
1810 |
"
|
|
1811 |
(info at:1) == #lsbFirst ifTrue:[
|
|
1812 |
buffer := ByteArray new:bytesPerLine.
|
|
1813 |
dstIndex := 1.
|
|
1814 |
1 to:height do:[:hi |
|
|
1815 |
buffer replaceFrom:1 to:bytesPerLine with:inData startingAt:dstIndex.
|
|
1816 |
buffer reverse.
|
|
1817 |
inData replaceFrom:dstIndex to:dstIndex+bytesPerLine-1 with:buffer startingAt:1.
|
|
1818 |
dstIndex := dstIndex + bytesPerLine
|
|
1819 |
]
|
|
1820 |
].
|
|
1821 |
|
54
|
1822 |
^ inData.
|
0
|
1823 |
!
|
|
1824 |
|
12
|
1825 |
forgetBits
|
|
1826 |
"for image, which also keeps the bits - so there is
|
|
1827 |
no need to hold them again here"
|
|
1828 |
|
|
1829 |
data := nil
|
|
1830 |
!
|
|
1831 |
|
0
|
1832 |
photometric
|
|
1833 |
"for compatibility with Image class ..."
|
|
1834 |
|
|
1835 |
depth == 1 ifTrue:[
|
78
|
1836 |
((localColorMap at:1) = Color white) ifTrue:[
|
|
1837 |
((localColorMap at:1) = Color black) ifTrue:[
|
|
1838 |
^ #whiteIs0
|
|
1839 |
].
|
|
1840 |
].
|
|
1841 |
((localColorMap at:1) = Color black) ifTrue:[
|
|
1842 |
((localColorMap at:1) = Color white) ifTrue:[
|
|
1843 |
^ #blackIs0
|
|
1844 |
].
|
|
1845 |
].
|
0
|
1846 |
].
|
|
1847 |
^ #palette
|
|
1848 |
!
|
|
1849 |
|
|
1850 |
samplesperPixel
|
12
|
1851 |
"for compatibility with Image class ..."
|
|
1852 |
|
0
|
1853 |
^ 1
|
|
1854 |
!
|
|
1855 |
|
|
1856 |
bitsPerSample
|
12
|
1857 |
"for compatibility with Image class ..."
|
|
1858 |
|
0
|
1859 |
^ Array with:depth
|
54
|
1860 |
!
|
|
1861 |
|
|
1862 |
filename
|
|
1863 |
"return the filename, from which the receiver was created,
|
|
1864 |
or nil, if it was not read from a file"
|
|
1865 |
|
|
1866 |
^ fileName
|
0
|
1867 |
! !
|
|
1868 |
|
99
|
1869 |
!Form methodsFor:'queries '!
|
|
1870 |
|
|
1871 |
isForm
|
|
1872 |
"return true, if the receiver is some kind of form;
|
|
1873 |
true is returned here - the method is redefined from Object."
|
|
1874 |
|
|
1875 |
^ true
|
|
1876 |
!
|
|
1877 |
|
|
1878 |
isImageOrForm
|
|
1879 |
"return true, if the receiver is some kind of image or form;
|
|
1880 |
true is returned here - the method is redefined from Object."
|
|
1881 |
|
|
1882 |
^ true
|
|
1883 |
! !
|
|
1884 |
|
0
|
1885 |
!Form methodsFor:'image manipulations'!
|
|
1886 |
|
54
|
1887 |
lightened
|
|
1888 |
"kludge - actually should return a lightened image ..
|
|
1889 |
(or Color white ?)"
|
|
1890 |
|
|
1891 |
^ self
|
|
1892 |
!
|
|
1893 |
|
|
1894 |
darkened
|
|
1895 |
"kludge - actually should return a darkened image ..
|
|
1896 |
(or Color black ?)"
|
|
1897 |
|
|
1898 |
^ self
|
|
1899 |
!
|
|
1900 |
|
134
|
1901 |
magnifyBy:scale
|
|
1902 |
"obsolete: has been renamed to magnifiedBy: for ST-80 compatibility
|
|
1903 |
and name consistency ..."
|
|
1904 |
|
|
1905 |
self obsoleteMethodWarning.
|
|
1906 |
^ self magnifiedBy:scale
|
|
1907 |
!
|
|
1908 |
|
|
1909 |
magnifiedBy:extent
|
0
|
1910 |
"return a new form magnified by extent, aPoint.
|
134
|
1911 |
If non-integral magnify is asked for, pass the work on to 'hardMagnifiedBy:'"
|
0
|
1912 |
|
134
|
1913 |
|mX mY dstX dstY newForm ext
|
|
1914 |
factor "{ Class: SmallInteger }"
|
|
1915 |
n "{ Class: SmallInteger }" |
|
0
|
1916 |
|
133
|
1917 |
ext := extent asPoint.
|
|
1918 |
mX := ext x.
|
|
1919 |
mY := ext y.
|
0
|
1920 |
((mX = 1) and:[mY = 1]) ifTrue:[^ self].
|
|
1921 |
|
12
|
1922 |
((mX isMemberOf:SmallInteger) and:[mY isMemberOf:SmallInteger]) ifFalse:[
|
134
|
1923 |
^ self hardMagnifiedBy:ext
|
0
|
1924 |
].
|
|
1925 |
|
|
1926 |
newForm := ((self class) on:device)
|
78
|
1927 |
width:(width * mX)
|
|
1928 |
height:(height * mY)
|
|
1929 |
depth:depth.
|
0
|
1930 |
|
|
1931 |
"expand rows"
|
|
1932 |
(mY > 1) ifTrue:[
|
78
|
1933 |
dstY := 0.
|
134
|
1934 |
n := height.
|
|
1935 |
factor := mY.
|
|
1936 |
0 to:(n - 1) do:[:srcY |
|
|
1937 |
1 to:factor do:[:i |
|
78
|
1938 |
newForm copyFrom:self
|
|
1939 |
x:0 y:srcY
|
|
1940 |
toX:0 y:dstY
|
|
1941 |
width:width height:1.
|
|
1942 |
dstY := dstY + 1
|
|
1943 |
]
|
|
1944 |
]
|
0
|
1945 |
].
|
|
1946 |
|
|
1947 |
"expand cols"
|
|
1948 |
(mX > 1) ifTrue:[
|
134
|
1949 |
n := width.
|
|
1950 |
factor := mX.
|
|
1951 |
dstX := (n * factor) - 1.
|
|
1952 |
(n - 1) to:0 by:-1 do:[:srcX |
|
|
1953 |
1 to:factor do:[:i |
|
78
|
1954 |
newForm copyFrom:newForm
|
|
1955 |
x:srcX y:0
|
|
1956 |
toX:dstX y:0
|
|
1957 |
width:1 height:(height * mY).
|
|
1958 |
dstX := dstX - 1
|
|
1959 |
]
|
|
1960 |
]
|
0
|
1961 |
].
|
46
|
1962 |
newForm colorMap:localColorMap.
|
0
|
1963 |
^ newForm
|
|
1964 |
|
133
|
1965 |
"
|
134
|
1966 |
(ArrowButton upArrowButtonForm:#iris on:Display) magnifiedBy:(2 @ 2)
|
|
1967 |
(Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(2 @ 2)
|
|
1968 |
(Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(0.4 @ 0.4)
|
133
|
1969 |
"
|
0
|
1970 |
!
|
|
1971 |
|
134
|
1972 |
hardMagnifiedBy:extent
|
89
|
1973 |
"return a new form magnified by extent, aPoint.
|
|
1974 |
This method handles non-integral factors."
|
|
1975 |
|
|
1976 |
"
|
|
1977 |
since Form will be replaced by Image in the long run,
|
|
1978 |
and this operation is slow anyway, use the implementation
|
|
1979 |
in Image for this."
|
|
1980 |
|
134
|
1981 |
^ ((Image fromForm:self) magnifiedBy:extent) asFormOn:device.
|
89
|
1982 |
|
|
1983 |
"
|
134
|
1984 |
(Form fromFile:'OutputOn.64') magnifiedBy:0.5@0.5
|
|
1985 |
(Form fromFile:'OutputOn.64') magnifiedBy:1.5@1.5
|
89
|
1986 |
"
|
|
1987 |
!
|
|
1988 |
|
12
|
1989 |
flipVertical
|
|
1990 |
"return a new form flipped vertically"
|
0
|
1991 |
|
133
|
1992 |
|dstX newForm nCols "{ Class: SmallInteger }" |
|
134
|
1993 |
|
0
|
1994 |
newForm := ((self class) on:device)
|
78
|
1995 |
width:width
|
|
1996 |
height:height
|
|
1997 |
depth:depth.
|
0
|
1998 |
"expand cols"
|
|
1999 |
dstX := width - 1.
|
133
|
2000 |
nCols := dstX // 2.
|
|
2001 |
0 to:nCols do:[:srcX |
|
78
|
2002 |
newForm copyFrom:self
|
|
2003 |
x:srcX y:0
|
|
2004 |
toX:dstX y:0
|
|
2005 |
width:1 height:height.
|
|
2006 |
dstX := dstX - 1
|
0
|
2007 |
].
|
46
|
2008 |
newForm colorMap:localColorMap.
|
0
|
2009 |
^ newForm
|
|
2010 |
!
|
|
2011 |
|
12
|
2012 |
flipHorizontal
|
|
2013 |
"return a new form flipped horizontally"
|
0
|
2014 |
|
133
|
2015 |
|dstY newForm nRows "{ Class: SmallInteger }" |
|
71
|
2016 |
|
0
|
2017 |
newForm := ((self class) on:device)
|
78
|
2018 |
width:width
|
|
2019 |
height:height
|
|
2020 |
depth:depth.
|
0
|
2021 |
"expand rows"
|
133
|
2022 |
dstY := height - 1.
|
|
2023 |
nRows := dstY // 2.
|
|
2024 |
0 to:nRows do:[:srcY |
|
78
|
2025 |
newForm copyFrom:self
|
|
2026 |
x:0 y:srcY
|
|
2027 |
toX:0 y:dstY
|
|
2028 |
width:width height:1.
|
|
2029 |
dstY := dstY - 1
|
0
|
2030 |
].
|
46
|
2031 |
newForm colorMap:localColorMap.
|
0
|
2032 |
^ newForm
|
|
2033 |
! !
|
|
2034 |
|
86
|
2035 |
!Form methodsFor:'printing & storing'!
|
0
|
2036 |
|
|
2037 |
storeOn:aStream
|
|
2038 |
aStream nextPutAll:'(Form width:'.
|
|
2039 |
width storeOn:aStream.
|
|
2040 |
aStream nextPutAll:' height:'.
|
|
2041 |
height storeOn:aStream.
|
2
|
2042 |
aStream nextPutAll:' fromArray:('.
|
0
|
2043 |
self bits storeOn:aStream.
|
2
|
2044 |
aStream nextPutAll:'))'
|
0
|
2045 |
! !
|
|
2046 |
|
|
2047 |
!Form methodsFor:'editing'!
|
|
2048 |
|
|
2049 |
edit
|
133
|
2050 |
ImageEditView openOnImage:self
|
0
|
2051 |
|
133
|
2052 |
"
|
|
2053 |
(Form fromFile:'bitmaps/SBrowser.xbm') edit
|
|
2054 |
"
|
0
|
2055 |
!
|
|
2056 |
|
|
2057 |
show
|
133
|
2058 |
ImageView openOnImage:self
|
0
|
2059 |
|
133
|
2060 |
"
|
|
2061 |
(Form fromFile:'bitmaps/SBrowser.xbm') show
|
|
2062 |
"
|
0
|
2063 |
! !
|
|
2064 |
|
|
2065 |
!Form class methodsFor:'fileIn/Out'!
|
|
2066 |
|
|
2067 |
readFrom:fileName
|
151
|
2068 |
"same as Form>>fromFile: - for ST-80 compatibility.
|
|
2069 |
WARNING:
|
|
2070 |
Please do no longer use this, since it will not work
|
|
2071 |
correctly in multi-display applications (creates the form on the
|
|
2072 |
default Display).
|
|
2073 |
Use #fromFile:on: and pass the devive as argument."
|
|
2074 |
|
|
2075 |
^ self fromFile:fileName on:Display
|
|
2076 |
!
|
0
|
2077 |
|
151
|
2078 |
fromFile:filename
|
|
2079 |
"create a new form taking the bits from a file on the default device.
|
|
2080 |
WARNING:
|
|
2081 |
Please do no longer use this, since it will not work
|
|
2082 |
correctly in multi-display applications (creates the form on the
|
|
2083 |
default Display).
|
|
2084 |
Use #fromFile:on: and pass the devive as argument."
|
|
2085 |
|
|
2086 |
^ self fromFile:filename on:Display
|
0
|
2087 |
!
|
|
2088 |
|
|
2089 |
fromFile:filename on:aDevice
|
|
2090 |
"create a new form on device, aDevice and
|
|
2091 |
initialize the pixels from the file filename"
|
|
2092 |
|
|
2093 |
^ (self on:aDevice) readFromFile:filename
|
|
2094 |
!
|
|
2095 |
|
|
2096 |
fromFile:filename resolution:dpi on:aDevice
|
|
2097 |
"create a new form on device, aDevice and
|
|
2098 |
initialize the pixels from the file filename;
|
|
2099 |
the data in the file is assumed to be for dpi resolution;
|
58
|
2100 |
if it is different from the displays resolution, magnify or
|
|
2101 |
shrink the picture (but only in integer magnification steps)"
|
0
|
2102 |
|
|
2103 |
^ (self on:aDevice) readFromFile:filename resolution:dpi
|
|
2104 |
!
|
|
2105 |
|
|
2106 |
fromFile:filename resolution:dpi
|
|
2107 |
"create a new form taking the bits from a file on the default device
|
|
2108 |
the data in the file is assumed to be for dpi resolution;
|
58
|
2109 |
if it is different from the displays resolution, magnify or
|
151
|
2110 |
shrink the picture (but only in integer magnification steps).
|
|
2111 |
WARNING:
|
|
2112 |
Please do no longer use this, since it will not work
|
|
2113 |
correctly in multi-display applications (creates the form on the
|
|
2114 |
default Display).
|
|
2115 |
Use #fromFile:resolution:on: and pass the devive as argument."
|
0
|
2116 |
|
151
|
2117 |
^ self fromFile:filename resolution:dpi on:Display
|
0
|
2118 |
! !
|