Issue 3802 in pharo: A strange superclasses if Canvas

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Issue 3802 in pharo: A strange superclasses if Canvas

Status: Accepted
Owner: [hidden email]

New issue 3802 by [hidden email]: A strange superclasses if Canvas

Imagine that you can do something like:

Object new drawOnCanvas: World assuredCanvas

no, don't imagine. You can do that! :)
At least it is supposed to work, because Canvas inherits from some strange  
things (NullEncoder, FlattenEncoder),
so you can actually instruct any object to draw itself on canvas..
which is makes some sense (sort of):

Canvas>>draw: anObject
        ^anObject drawOn: self

        self flattenOnStream:aStream.

But as to me, Object should NOT implement #drawOnCanvas:, nor #drawOn:.  

The real users of protocols placed in NullEncoder and FlattenEncoder is  
PostscriptCanvas which are not included into core images.

So, the proposal is to remove the extra noise by making Canvas to be the  
subclass of Object.
And for things which do care about serializing drawing commands onto some  
stream (like PostScriptCanvas do), make a subclass and introduce this  
behavior later.