Various translation problems
Philippe de Rochambeau
pr1 at club-internet.fr
Mon Feb 23 16:49:47 UTC 1998
I am having problems translating the following snippets of code in the
"Duckling" example in Lalonde's "Inside Smalltalk II":
1)
erase
"I erase myself by whitening the area occupied by my icon."
Display white: (position extent: icon extent).
should "white:" be replaced by "fillWhite:"?
2)
"Next, create a mother duck with a bigger icon."
mother := self new. " mother icon: (ducklingIcon magnifyBy: 2 at 2).
what should I replace "magnifyBy" by?
3) [The following initialize method shows how duck bitmaps are created and
their extent defined during initialization. See below]
initialize
"MotherDuck initialize"
"Older implementation definitions"
DuckIcons := (1 to: 7) collect: [:index |
Cursor
perform: (#(origin corner crossHair up down read write)
at: index)].
DuckIconMenuNames := ('left corner\right corner\cross hair\up arrow\',
'down arrow\eyeglass\pen writing') withCRs.
"Newer implementation definitions."
DuckIcons := Array
with: (Form extent: 50 at 50
fromArray: #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0
0 0 0 0 0 1536 0 0 0768 0 15 57344 896 0 31 61440 390 0 56 6144 204
0 48 3072 220 0 97 33792 112 0 103 58550 240 0 480 512 176 0 1008
768 432 0 3888 480 864 0 16368 496 544 0 7984 26 608 0 2032 15
1568 0 510 5 33888 0 127 35840 60512 0 3 50688 14528 0 0 59136
4544 0 0 29568 384 0 0 12672 384 0 0 12480 12672 0 0 6368 29056 0
0 7291 50048 0 0 3135 33536 0 0 1567 1792 0 0 1792 1536 0 0 768
3072 0 0 896 7168 0 0 449 61440 0 0 255 57344 0 0 63 0 0 0 6 0 0 0 6
0 0 0 6 0 0 0 6 0 0 0 15 0 0 0 31 32768 0 0 58 49152 0 0 50
24576 0 0 34 24576 0)
offset: 0 at 0)
with: (Form extent: 50 at 50
fromArray: #(0 0 0 0 0 511 0 0 0 2047 49152 0 0 7681 6144 0 0 30720
61440 0 1 49152 30720 0 3 32768 7198 0 7 0 3584 0 6 0 1536 0 6 0
768 0 12 15360 768 0 24 65024 62336 0 25 50947 63872 0 57 37639
7360 0 49 14726 20160 0 49 64900 59072 0 113 65415 63072 0 96
1793 65120 0 96 0 3680 0 224 248 32 0 224 49151 32 0 199 63503
57376 0 511 1 63536 0 504 0 15408 0 448 0 3888 0 384 0 944 0 128 0
992 0 128 0 224 0 192 0 192 0 64 0 384 0 96 0 768 0 33 0 1536 0 49
57408 3072 0 17 61560 6144 0 24 124 12288 0 24 0 24576 0 12 0
3 49276 0 0 3 49368 0 0 6 24972 0 0 6 26380 0 0 12 15372 0 0 12
14348 0 0 12 4100 0 0)
offset: 0 at 0)
[etc]
=======
the "quack" instance method contains the following line of code:
iconOffset := self icon extent // 2.
However, I get a "message not understood: extent" message at that point in the
code. Why? What is "extent" an instance variable of?
Many thanks.
Philippe de Rochambeau
More information about the Squeak-dev
mailing list
|