
Making WMF files from Smalltalk
Hi,
I'm trying to find a sensible way of getting vector graphic output from
VisualWorks into e.g. Word. We don't need anything very fancy: text,
polylines and ellipses are fine (i.e. what you find in a CASE tool diagram).
The only built in ways to integrate VisualWorks graphics with other programs
seem to be bitmaps (look bad when printed, or then are huge) or printing to
EPS using Windows' own printer drivers (unfortunately do not generate a
bitmap preview, so Word can't show them on the screen; also Windows doesn't
seem to clip them properly).
I can see two ways forward: either printing to EPS and I make a TIFF bitmap
and stick it in the EPS file afterwards (any free TIFF code about?), or
writing classes to export WMF (to a file, since I don't think VW has the
primitives to put WMF-type data on the clipboard).
Although I know little about the Windows GDI, the WMF format seems easy
enough: each drawing command is a record which indicates what kind of shape
to draw, how long the record is, and the parameters for the shape (e.g. x &
y co-ords). My guess is that implementing this would be quite easy as a
subclass of ScreenGraphicsContext: just add an instance variable for a
stream of binary records, and override each primitive to output a record to
that stream. Add a bit of magic to handle #paint: settings (e.g. instance
variable for current WMF pen and brush), and it should be almost done.
Before I go ahead and waste my time, does anyone out there know of a VW
product that already allows WMF export, or does anyone know why my solution
won't work or a better way of doing it?
Thanks!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WWW http://www.metacase.com ~~~~~~~~~~~
Steven Kelly tel +358 14 4451401 fax 4451405
Product Development Manager_ _mobile +358 40 7331286 _ _
MetaCase Consulting, Ylistonmaentie 31, FIN-40500 Jyvaskyla, Finland