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