[Pharo-dev] InfiniteForm

Igor Stasenko siguctua at gmail.com
Wed Apr 16 20:20:41 EDT 2014


On 15 April 2014 23:15, pharo4Stef at free.fr <pharo4Stef at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20140417/0dc8ae04/attachment-0002.html>


More information about the Pharo-dev mailing list