On 15 April 2014 23:15, pharo4Stef@free.fr <pharo4Stef@free.fr> wrote:
There a plenty of isKindOf: InfiniteForm in the system and I was trying to understand how we could get rid of them.
How other systems handle pattern based color filling shape?
why bother?
Just use The God's Hammer Dispatch (AKA Non-intuitive way of programming
for those who don't think in objects ;) :
fillRectangle: aRectangle basicFillStyle: aFillStyle
������ "Fill the given rectangle with the given, non-composite, fill style."
������
������ | pattern |
������ (aFillStyle isKindOf: InfiniteForm) ifTrue: [
������ ������ ^self infiniteFillRectangle: aRectangle fillStyle: aFillStyle
������ ].
=>
fillRectangle: aRectangle basicFillStyle: aFillStyle
������ "Fill the given rectangle with the given, non-composite, fill style."
������ ^ aFillStyle fillRectangle: aRectangle onCanvas: self
��
..and then after refactoring it will look exactly how Athens doing it,
because if you rename fill style with "paint" and rectangle with "shape" you will see it :)
Stef
--
Best regards,
Igor Stasenko.