[etoys-dev] Etoys: Morphic-bf.12.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun May 30 17:56:02 EDT 2010
Bert Freudenberg uploaded a new version of Morphic to project Etoys:
http://source.squeak.org/etoys/Morphic-bf.12.mcz
==================== Summary ====================
Name: Morphic-bf.12
Author: bf
Time: 30 May 2010, 11:53:56 pm
UUID: a7f4a3c2-17fc-4976-ba3d-d4bc1c11880d
Ancestors: Morphic-kfr.11
- move overlapsShadowForm:bounds: back to Morphic package
=============== Diff against Morphic-kfr.11 ===============
Item was added:
+ ----- Method: Morph>>overlapsShadowForm:bounds: (in category '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