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