[Pharo-dev] [ bloc ] I do not understand why some behavior is not in the right place
stepharo at free.fr
Wed Apr 6 08:49:42 EDT 2016
ok let me know when you have a new "stable" version so that I try my
Le 4/4/16 23:21, Andrei Chis a écrit :
> Hi Stef,
> Currently there was a distinction between Shape and Path which turn
> out to be confusing. So Shape will go away and there will be just a
> Path (line, circle, rectangle, etc). We started to refactor this
> during the PharoDays. And yes, Rectangle will be polymorphic with Path.
> BlElement does support clipping and click detection by paths but right
> now they were implicit and you needed to subclass BlElement to
> override them independently. We'll change this so one can set them
> independently in BlElement.
> Yes, BlElement had a default path for drawing but that will go away.
> By default BlElement will have an empty drawOn... method. So to create
> a custom widget you can subclass BlElement, override drawOn... and use
> the canvas to draw anything you wish.
> There will be a subclass of BlElement that will add more drawing
> oriented logic but BlElement will be independent of that.
> Yes, the API of the canvas is not perfect but we're improving.
> On Mon, Apr 4, 2016 at 6:00 PM, stepharo <stepharo at free.fr
> <mailto: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.
> 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
> 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.
> transform: self transformation
> during: [
> self clippingStrategy
> clip: self
> on: aCanvas
> during: [ self drawOnSpartaCanvas: aCanvas ]
> childrenDuring: [ self drawChildrenOnSpartaCanvas:
> aCanvas ] ]
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-dev