[etoys-dev] Etoys: Connectors-kfr.188.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat May 29 19:48:08 EDT 2010
Karl Ramberg uploaded a new version of Connectors to project Etoys:
http://source.squeak.org/etoys/Connectors-kfr.188.mcz
==================== Summary ====================
Name: Connectors-kfr.188
Author: kfr
Time: 30 May 2010, 1:48:03 am
UUID: 2707f7a6-10ce-f343-bac3-aed3a747f5eb
Ancestors: Connectors-bf.187
Fix the overlap logic in Morph>>overlapsShadowForm:bounds:
Fix for not including self in testing for overlaps i Player>>overlapsAny:
Refactor Player>>overlaps: to use Morph>>overlapsShadowForm:bounds:
=============== Diff against Connectors-bf.187 ===============
Item was added:
+ ----- Method: Morph>>overlapsShadowForm:bounds: (in category '*connectors-geometry') -----
+ overlapsShadowForm: itsShadow bounds: itsBounds
+ "Answer true if itsShadow and my shadow overlap at all"
+ | overlapExtent overlap myRect myShadow goalRect goalShadow bb |
+ overlap _ self fullBounds intersect: itsBounds.
+ overlapExtent _ overlap extent.
+ overlapExtent > (0 @ 0)
+ ifFalse: [^ false].
+ myRect := overlap translateBy: 0 @ 0 - self topLeft.
+ myShadow := (self imageForm contentsOfArea: myRect) stencil.
+ goalRect := overlap translateBy: 0 @ 0 - itsBounds topLeft.
+ goalShadow := (itsShadow contentsOfArea: goalRect) stencil.
+
+ "compute a pixel-by-pixel AND of the two stencils. Result will be black
+ (pixel value = 1) where black parts of the stencils overlap"
+ bb := BitBlt toForm: myShadow.
+ bb
+ copyForm: goalShadow
+ to: 0 @ 0
+ rule: Form and.
+
+ ^(bb destForm tallyPixelValues second) > 0 !
More information about the etoys-dev
mailing list