The test case in EPSCanvasTest (introduced today with MorphicExtras-hjh.210.mcz)
shows what happens if you move
FlattenEncoder subclass: #Canvas
to Object subclass: Canvas
See comment there.
--Hannes
On 9/30/17, H. Hirzel hannes.hirzel@gmail.com wrote:
Tobias, thank you for referring to Marcel Weiher as the author of the Postscript support in Squeak. This helped me to find the following email with comments about the Encoder hierarchy
<citation> Marcel Weiher <marcel.weiher@gmail.com> Wed, Feb 27, 2013 at 9:14 PM To: The general-purpose Squeak developers list <squeak-dev@lists.squeakfoundation.org>
On Feb 25, 2013, at 20:22 , Nicolas Cellier nicolas.cellier.aka.nice@gmail.com wrote:
Great, that confirms my own analyze. But the parallel hierarchy PrintEncoder StoreEncoder and PropertyListEncoder are presumably not used, and were just experiments right?
Pretty sure, yes.
</citation>
So it seems that
NullEncoder FlattenEncoder ByteEncoder PrintableEncoder
are a means to structure the code for the subclass PostscriptEncoder and thus to help to understand how the code works (see attached screen shot).
NullEncoder FlattenEncoder ByteEncoder PrintableEncoder PostscriptEncoder
Note that Canvas and thus then PostscriptCanvas is a subclass of FlattenEncoder. As Nicolas Cellier points out only PostscriptCanvas and subclasses use the NullEncoder and FlattenEncoder protocols. For example aMorph asEPS calls ^ EPSCanvas morphAsPostscript: self rotated: false. which at the end does ^target contents. which is implemented in NullEncoder.
The question thus is how much does PostScriptCanvas rely on the NullEncoder and FlattenEncoder protocols?
It might be quite easily possible to reimplement the necessary methods in PostScriptEncoder and then make Canvas a subclass of Object.
This will allow Canvas and subclasses to be put into a separate category 'Graphics-Canvas' in the base system.
PostScript support would then be something added on top of it.
To summarize:
The refactoring idea brought up for discussion is thus
- Push the necessary NullEncoder and FlattenEncoder instance variable
'target' and the necessary methods down to PostscriptCanvas
- Make Canvas a subclass of object thus separating then Encoder
hierarchy from the Canvas hierarchy.
- Put Canvas and some subclasses into a category 'Graphics-Canvas'
Regards
Hannes Hirzel
--Hannes
On 9/30/17, Tobias Pape Das.Linux@gmx.de wrote:
On 30.09.2017, at 01:42, David T. Lewis lewis@mail.msen.com wrote:
According to the update stream history at http://files.squeak.org/history, NullEncoder and friends were added in 1466EncodingFilters-MPW.cs by MPW:
Object subclass: #NullEncoder NullEncoder subclass: #FlattenEncoder FlattenEncoder subclass: #ByteEncoder ByteEncoder subclass: #PrintableEncoder PrintableEncoder subclass: #PrintEncoder PrintableEncoder subclass: #PropertyListEncoder PrintableEncoder subclass: #StoreEncoder
According to SqueakMap, MPW is Mark McCahill (mccahill@duke.edu).
No, thats Marcel Weiher. He did a quite a lot Squeak/Postscript Stuff. I CC'ed him.
Marcel, can you comment on the Encoder Hierarchie? (Full thread here)
Best regards -Tobias
According to Wikipedia, Mark McCahill at Duke is this guy: https://en.wikipedia.org/wiki/Mark_P._McCahill
According to the method time stamps, these classes date back to January 1901, so probably actually 2001.
Dave