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@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.