Tobias
You write that NullEncoder and subclasses could be summarized as
"Put objects onto another thing with encoding inbetween".
which I think is helpful for understanding.
Maybe we consider for the class comment of NullEncoder
"Put objects onto another thing with encoding/transformation inbetween".
But also note that this is not only related to PostscriptCanvas as we have
NullEncoder FlattenEncoder Canvas FormCanvas
FormCanvas has some nice usage examples.
#test1 is
test1 "FormCanvas test1"
| canvas | canvas := FormCanvas extent: 200@200. canvas fillColor: (Color black). canvas line: 10@10 to: 50@30 width: 1 color: (Color red). canvas frameRectangle: ((20@20) corner: (120@120)) width: 4 color: (Color green). canvas point: 100@100 color: (Color black). canvas drawString: 'Hello, World!' at: 40@40 font: nil color: (Color cyan). canvas fillRectangle: ((10@80) corner: (31@121)) color: (Color magenta). canvas fillOval: ((10@80) corner: (31@121)) color: (Color cyan). canvas frameOval: ((40@80) corner: (61@121)) color: (Color blue). canvas frameOval: ((70@80) corner: (91@121)) width: 3 color: (Color red alpha: 0.2). canvas fillRectangle: ((130@30) corner: (170@80)) color: (Color lightYellow). canvas showAt: 0@0.
This works fine in an MVC project
--Hannes
On 9/29/17, Tobias Pape Das.Linux@gmx.de wrote:
Hi Hannes
On 29.09.2017, at 15:21, H. Hirzel hannes.hirzel@gmail.com wrote:
And there is no 'FlattenEncoder' in Pharo 6
On 9/29/17, H. Hirzel hannes.hirzel@gmail.com wrote:
We have
NullEncoder FlattenEncoder Canvas
So here's the Thing: I looked in 3.8, and there's:
Object NullEncoder - Morphic-Postscript Filters FlattenEncoder - Morphic-Postscript Filters Canvas - Morphic-Support PostscriptCanvas - Morphic-Postscript Canvases
But also note that they all have a callback via class>>filterSelector:
NullEncoder>>filterSelector ^ #writeOnFilterStream: FlattenEncoder>>filterSelector ^ #flattenOnStream: Canvas>>filterSelector ^ #drawOnCanvas: PostscriptCanvas>>filterSelector ^ #fullDrawPostscriptOn:
I think part of that happened because this all shared common functionallity, In the sense that all those things "Put objects onto another thing with encoding inbetween". Thinking of things like a n-dimensonal stream or so…
I checked and It is like that even in Squeak 3.6, 3.0, 2.8. Squeak 1.13 does not have any of those, and it has no Morphic.
Self Morphic does not have such Encoders, tho.
In the end it all seems to be related to the PostScript Canvas, which, understandably, has to have access to certain objects and actually has to "encode" them into a file.
Best regards -Tobias
there are no direct users of NullEncoder and FlattenEncoder.
FlattenEncoder class comment is just
'The simplest possible encoding: leave the objects as is.'
a bit terse. Does not really say what the issue is about.
On 9/29/17, H. Hirzel hannes.hirzel@gmail.com wrote:
P.S.
There is no NullEncoder in Pharo.
The class Canvas is not in a package 'Morphic-Support' but in a package 'Graphics-Canvas'.
There is no 'Graphics-Canvas' package in Squeak. [2]
Seems like a good idea to move Canvas and subclasses to a package 'Graphics-Canvas' as well.
[2] Graphics package in Squeak 6.0a-17405
Graphics-Display Objects Graphics-External-Ffenestri Graphics-Files Graphics-Fonts Graphics-Primitives Graphics-Text Graphics-Transformations GraphicsTests-Files GraphicsTests-Primitives GraphicsTests-Text
On 9/29/17, H. Hirzel hannes.hirzel@gmail.com wrote:
Hello
NullEncoder is subclass of object ([1] for full hierachy). It is a superclass of Canvas.
What is the function of NullEncoder. No class comment so far?
Regards Hannes
[1] NullEncoder printHierarchy ' ProtoObject #() Object #() NullEncoder #(''target'' ''filterSelector'') FlattenEncoder #() ByteEncoder #() PrintableEncoder #() PostscriptEncoder #() PostscriptEncoderToDisk #() PropertyListEncoder #() Canvas #() ColorMappingCanvas #(''myCanvas'') AlphaBlendingCanvas #(''alpha'') ShadowDrawingCanvas #(''shadowColor'') FormCanvas #(''origin'' ''clipRect'' ''form'' ''port'' ''shadowColor'') BalloonCanvas #(''transform'' ''colorTransform'' ''engine'' ''aaLevel'' ''deferred'') BlueFormCanvas #() ColorPatchCanvas #(''stopMorph'' ''foundMorph'' ''doStop'') MultiResolutionCanvas #(''deferredMorphs'') PluggableCanvas #() BufferedCanvas #(''remote'' ''previousVersion'' ''lastTick'' ''dirtyRect'' ''mirrorOfScreen'') CachingCanvas #(''cacheCanvas'' ''mainCanvas'') ClippingCanvas #(''canvas'' ''clipRect'') MultiCanvas #(''canvases'' ''extent'' ''depth'') NullCanvas #() PostscriptCanvas #(''origin'' ''clipRect'' ''currentColor'' ''shadowColor'' ''currentFont'' ''morphLevel'' ''gstateStack'' ''fontMap'' ''usedFonts'' ''psBounds'' ''topLevelMorph'' ''initialScale'' ''savedMorphExtent'' ''currentTransformation'' ''printSpecs'' ''pages'') DSCPostscriptCanvas #() DSCPostscriptCanvasToDisk #() EPSCanvas #() RemoteCanvas #(''innerClipRect'' ''outerClipRect'' ''transform'' ''connection'' ''shadowColor'')'