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

Tudor Girba tudor at tudorgirba.com
Mon Apr 4 11:35:42 EDT 2016


Hi,

Please take the latest version :).

Cheers,
Doru



> On Apr 4, 2016, at 8:28 AM, Igor Stasenko <siguctua at gmail.com> wrote:
> 
> What is it?
> 
> Why people so obsessed to overcomplicate everything?
> How drawFillOnAthensCanvas would look like, if you do things right?
> 
> BlElement >>drawOnAthensCanvas: aCanvas
>  ^ aCanvas draw: self shape.
> 
> pfff....
> 
> 
> On 4 April 2016 at 18:17, stepharo <stepharo at free.fr> wrote:
> BlElement >>drawStrokeOnAthensCanvas: aCanvas
>     "Actually render stroke of a receiver on aCanvas in local bounds.
>     Override to customize.
>     aCanvas is an instance of AthensCanvas
>     aCanvas must not be nil"
>     | pathTransform strokePath strokeScaling strokeOffset |
> 
>     "fast exit if stroke has no width or it is transparent"
>     (self shape strokePaint width <= 0 or: [ self shape strokePaint isTransparent ])
>         ifTrue: [ ^ self ].
> 
>     pathTransform := aCanvas pathTransform.
>     strokePath := self shape path strokePathOn: aCanvas.
>     strokeScaling := self shape path strokeScaling.
>     strokeOffset := self shape path strokeOffset.
> 
>     pathTransform restoreAfter:[
>         pathTransform translateBy: strokeOffset * strokeScaling.
>         pathTransform scaleBy: strokeScaling.
>         aCanvas
>             setPaint: self shape strokePaint;
>             drawShape: strokePath ]
> 
> 
> 
> 
> BlElement >>drawFillOnAthensCanvas: aCanvas
>     "Actually render fill of a receiver on aCanvas in local bounds.
>     Override to customize.
>     aCanvas is an instance of AthensCanvas
>     aCanvas must not be nil"
>     | pathTransform fillPath fillScaling fillOffset |
>     pathTransform := aCanvas pathTransform.
> 
>     "fast exit if fill is transparent"
>     (self shape fillPaint isTransparent)
>         ifTrue: [ ^ self ].
> 
>     fillPath := self shape path fillPathOn: aCanvas.
>     fillScaling := self shape path fillScaling.
>     fillOffset := self shape path fillOffset.
> 
>     pathTransform restoreAfter: [
>         pathTransform translateBy: fillOffset * fillScaling.
>         pathTransform scaleBy: fillScaling.
>         aCanvas
>             setPaint: self shape fillPaint;
>             drawShape: fillPath ]
> 
> 
> 
> 
> -- 
> Best regards,
> Igor Stasenko.

--
www.tudorgirba.com
www.feenk.com

"To utilize feedback, you first have to acquire it."




More information about the Pharo-dev mailing list