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 ]