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