How to write many Morphs to a Postscript file?

Ned Konz ned at bike-nomad.com
Tue Mar 6 20:16:47 UTC 2001


I'm trying to make a one-page Postscript output for a bunch of Morphs in
the World.

So far, I've got this, which makes a viewable (but wrong) Postscript
file:

"Dump the current drawing as a EPS file"
| ignore border morphs bounds canvas fileName |
ignore _ #( MenuMorph ProjectNavigationMorph FlapTab PasteUpMorph
SystemWindow ).
border _ 10.		"border width around drawing"
morphs _ World submorphs reject: [ :ea | ignore includes: ea class name
].
bounds _ morphs first bounds.
morphs do: [ :ea | bounds _ bounds merge: ea bounds ].
bounds _ bounds outsetBy: border.
canvas _ PostscriptCanvas new.
canvas reset; bounds: bounds; topLevelMorph: World; resetContentRotated:
false.
canvas fillColor: World color.
morphs reverseDo: [ :ea | ea fullDrawOn: canvas ].
fileName _ FileDirectory default nextNameFor: 'drawing' extension:
'eps'.
Utilities informUser: 'Writing ' , fileName
	during: [ (FileStream newFileNamed: fileName) nextPutAll: canvas
contents; close ].


Unfortunately, the drawing seems to be flopped vertically, and the
bounding box doesn't appear to be set right (for EPS, anyway).

I've tried the EPS canvas, but it wants to put each Morph in a separate
page, as does the DSC canvas.

Also, SketchMorphs don't seem to print out right (they have distorted
text or something in a rectangle of the correct size).

What am I missing here?





More information about the Squeak-dev mailing list