Section 4

We're going to handle blanking 4 quadrants in a mirror cell. Here are the new instance methods that handle the masking of each. These instance methods are added to the MirrorCellRenderer class.

maskForNorthEast
     | mask pen line cellPosn |
     mask := Form extent: CellRenderer cellExtent depth: 1.
     mask fillColor: Color white.
     pen := Form extent: 1@1 depth: 1.
     pen fillColor: Color black.
     line := Line
         from: 0@0
         to: mask extent
         withForm: pen.
     line displayOn: mask.
     mask floodFill: Color black at: 5@1.
     cellPosn := self offsetWithinGridForm.
     mask
         displayOn: self targetForm
         at: cellPosn
         clippingBox: self targetForm boundingBox
         rule: Form oldPaint
         fillColor: LaserGameColors gameBoardBackgroundColor.
     self renderBorderTop.
     self renderBorderRight

maskForNorthWest
     | mask pen line cellPosn |
     mask := Form extent: CellRenderer cellExtent depth: 1.
     mask fillColor: Color white.
     pen := Form extent: 1@1 depth: 1.
     pen fillColor: Color black.
     line := Line
         from: (mask width)@0
         to: 0@(mask height)
         withForm: pen.
     line displayOn: mask.
     mask floodFill: Color black at: 5@5.
     cellPosn := self offsetWithinGridForm.
     mask
         displayOn: self targetForm
         at: cellPosn
         clippingBox: self targetForm boundingBox
         rule: Form oldPaint
         fillColor: LaserGameColors gameBoardBackgroundColor.
     self renderBorderTop.
     self renderBorderLeft

maskForSouthEast
     | mask pen line cellPosn |
     mask := Form extent: CellRenderer cellExtent depth: 1.
     mask fillColor: Color white.
     pen := Form extent: 1@1 depth: 1.
     pen fillColor: Color black.
     line := Line
         from: (mask width)@0
         to: 0@(mask height)
         withForm: pen.
     line displayOn: mask.
     mask floodFill: Color black at: (mask width - 5)@(mask height - 5).
     cellPosn := self offsetWithinGridForm.
     mask
         displayOn: self targetForm
         at: cellPosn
         clippingBox: self targetForm boundingBox
         rule: Form oldPaint
         fillColor: LaserGameColors gameBoardBackgroundColor.
     self renderBorderBottom.
     self renderBorderRight

maskForSouthWest
     | mask pen line cellPosn |
     mask := Form extent: CellRenderer cellExtent depth: 1.
     mask fillColor: Color white.
     pen := Form extent: 1@1 depth: 1.
     pen fillColor: Color black.
     line := Line
         from: 0@0
         to: mask extent
         withForm: pen.
     line displayOn: mask.
     mask floodFill: Color black at: 1@5.
     cellPosn := self offsetWithinGridForm.
     mask
         displayOn: self targetForm
         at: cellPosn
         clippingBox: self targetForm boundingBox
         rule: Form oldPaint
         fillColor: LaserGameColors gameBoardBackgroundColor.
     self renderBorderBottom.
     self renderBorderLeft

Index Page Next Page

Copyright © 2007, 2008, 2009, 2010 Stephan B Wessels    stevewessels@me.com