[Pharo-dev] [ bloc ] I do not understand why some behavior is not in the right place

stepharo stepharo at free.fr
Mon Apr 4 12:00:31 EDT 2016


I saw in bleedingEdge it is different and looks better.
Now I was wondering why shape did not do the rendering and I thought 
that this is may be because a shape can be used for doing something else
than rendering. For example clipping or as igor mentioned defining the 
shape of the interaction



drawOnSpartaCanvas: aCanvas
     "Actually render receiver on aCanvas in local bounds.
     Override to customize.
     aCanvas is an instance of AthensCanvas
     aCanvas must not be nil"

     self assert: self shape path context isNotNil.

     aCanvas
         clipPreserveBy: self shape during: [
             aCanvas paintGroup: [
                 aCanvas setPaint: self shape fillPaint.
                 aCanvas fillPreserve.
                 aCanvas paintMode source.
                 aCanvas setStrokePaint: self shape strokePaint.
                 aCanvas stroke ] ]



unprotectedFullDrawOnSpartaCanvas: aCanvas
     "Draw the full structure on the given Canvas withing drawing bounds
     without caring about any errors and visibility. I am responsible for
     clipping and transforming canvas's path to local coordinates
     to allow simpler actual drawing in drawOnAthensCanvas:
     Additional checks should be implemented in fullDrawOnAthensCanvas:
     aCanvas is an instance of AthensCanvas.
     aCanvas must not be nil.
     @see BlElement>>#fullDrawOnAthensCanvas:
     @see BlElement>>#drawOnAthensCanvas:"
     self shape adaptTo: self.
     self shape path context: aCanvas.

     aCanvas
         transform: self transformation
         during: [
             self clippingStrategy
                 clip: self
                 on: aCanvas
                 during: [ self drawOnSpartaCanvas: aCanvas ]
                 childrenDuring: [ self drawChildrenOnSpartaCanvas: 
aCanvas ] ]



More information about the Pharo-dev mailing list