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

stepharo stepharo at free.fr
Mon Apr 4 16:17:25 EDT 2016


I have the impression that
clipping and interaction can be defined by a "shape"
then the drawing can be either drawn in a canvas or delegate to 
something else (for example for the cursor if there is an hardware 

I like this discussion and the feedback of igor because he is kicking 
our asses much better than me in fact
because he has real argument while I just got feelings :)


Le 4/4/16 19:10, Tudor Girba a écrit :
> Hi,
> Indeed, this was not clear. The original idea of the shape was to be primarily responsible for the clipping, but in the meantime the stroke and fill filtered in the implementation. Alex, Andrei and I will now change the “shape” to only be responsible for clipping and leave the drawing to the element. We will also propose a solution for dealing with drawing and interaction.
> Please stay tuned and thanks for this discussion.
> Cheers,
> Doru
>> On Apr 4, 2016, at 9:00 AM, stepharo <stepharo at free.fr> wrote:
>> 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 ] ]
> --
> www.tudorgirba.com
> www.feenk.com
> "To utilize feedback, you first have to acquire it."

More information about the Pharo-dev mailing list