I found do: in non-collection code
John-Reed Maffeo (rlpa80)
rlpa80 at email.sps.mot.com
Wed Mar 31 05:45:31 UTC 1999
John,
I mentioned a bug on the Squeak mailing list yesterday and I have
tracked down more information about it.
do: is used in the method displayOn:transformation:clippingBox:rule:fillColor:
in the classes Path, Line, LinearFit, CurveFitter Spline. The method
is overwritten in each subclass, but I don't think that it needs to be.
The scaleBy: and translateBy: methods can be modified as attached
and the displayOn:... methods removed from the four subclasses and
the one in Path replaced by my version.
Along with those changes, the classes Arc and Circle should be removed
from the Path hierarchy. They don't use the Path instance variable
collectionOfPoints and many of their inherited methods don't make
sense (at least to me).
There seems to be two Path type root classes. One for point paths
and one for algorithmic paths. The commonality of the classes being
the form used to draw them out.
John-Reed Maffeo
Mesa, Arizona
Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="522A6368"; name="Pathfixes.30Mar750pm.cs"
Content-Transfer-Encoding: 7bit
Content-Description: BBEdit Lite 3.0 Document
Content-Disposition: inline; filename="Pathfixes.30Mar750pm.cs"
'From Squeak 2.3 of January 14, 1999 on 30 March 1999 at 7:50:40 pm'!
!Path methodsFor: 'transforming' stamp: 'jrm 3/30/1999 19:36'!
scaleBy: aPoint
"Answers a new Path scaled by aPoint. Does not affect the current data in
this Path."
| newPath |
newPath _ self species new: self size.
newPath form: self form.
collectionOfPoints do:
[:element |
newPath add:
(aPoint asPoint x * element x) asInteger @ (aPoint asPoint y * element y) asInteger].
^newPath! !
!Path methodsFor: 'transforming' stamp: 'jrm 3/30/1999 19:38'!
translateBy: aPoint
"Answers a new Path whose elements are translated by aPoint. Does not
affect the elements of this Path."
| newPath |
newPath _ self species new: self size.
newPath form: self form.
collectionOfPoints do:
[:element |
newPath add:
(element x + aPoint x) asInteger @ (element y + aPoint y) asInteger].
^newPath! !
!Path methodsFor: 'displaying' stamp: 'jrm 3/30/1999 19:40'!
displayOn: aDisplayMedium transformation: aTransformation clippingBox: clipRect rule: anInteger fillColor: aForm
| transformedPath |
"get the scaled and translated Path."
transformedPath _ aTransformation applyTo: self.
transformedPath
displayOn: aDisplayMedium
at: 0 @ 0
clippingBox: clipRect
rule: anInteger
fillColor: aForm.! !
More information about the Squeak-dev
mailing list
|