Making WMF files from Smalltalk 
Author Message
 Making WMF files from Smalltalk

There's an easier way.  Create your graphic images in VW.  If you get them as a
Pixmap (either by rendering or sending #asRetainedMedium to an Image), you can
send #toClipboard to the object.  Now that it's on the clipboard, you can easily
import it into Word (or anything else that can access the clipboard).

To make this less intrusive, you can use COM Connect or DDE to dump images back
and forth.

Quote:

> 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).

<snip>

Quote:
> Thanks!
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WWW http://www.*-*-*.com/ ~~~~~~~~~~~
> Steven Kelly                   tel    +358 14 4451401  fax 4451405
> Product Development Manager_  _mobile +358 40 7331286  _    _
> MetaCase Consulting,  Ylistonmaentie 31, FIN-40500  Jyvaskyla, Finland

--
James A. Robertson
Senior Sales Engineer, ObjectShare

410 884-4042

<Opinions expressed are not necessarily those of ObjectShare>



Wed, 18 Jun 1902 08:00:00 GMT  
 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



Wed, 18 Jun 1902 08:00:00 GMT  
 Making WMF files from Smalltalk

Quote:

>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

FYI, compressed tiff is subject to the unisys gif-license. Therefore, even
if there's some free code you've to obtain a license for any commercial
application.

Quote:
>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).

No it hasn't. Unfortunately.  I'd actually exactly the same idea for nearly
the same problem (CASE and that stuff). Go for it and send me your code. Or
pay me and I send you the code :-)

I looked already into the GraphicsContext class but it seems to be a larger
effort than expected, especially if you want to support images. Therefore,
I'd suggest to create your own abstract canvas class, of which GDICanvas,
WMFCanvas (and perhaps PrinterCanvas) are subclasses. Then implement some
"gdiDrawOn: aCanvas" methods for all graphical objects you want to display.
I hope, it might be also possible to use the GDICanvas instead of the
normal graphics context. This would solve all existing (and annoying) font
problems.  You'd of course loose platform independence, but who cares...

bye
--
Stefan Matthias Aust  //  Are you ready to discover the twilight zone?



Wed, 18 Jun 1902 08:00:00 GMT  
 Making WMF files from Smalltalk

Quote:

>There's an easier way.  Create your graphic images in VW.  If you get them as a
>Pixmap (either by rendering or sending #asRetainedMedium to an Image), you can
>send #toClipboard to the object.  Now that it's on the clipboard, you can easily
>import it into Word (or anything else that can access the clipboard).

You cannot scale Pixmaps without of visible loss, once you've created them.
Furthermore, you can only copy 256 color bitmaps from VisualWorks to the
clipboard (otherwise you'll get a primitive failure) and even these cannot
keep their colors (so it seems) when copied to Winword for example. Perhaps
VW doesn't also paste its color map into the clipboard? This isn't the best
solution IMHO.

bye
--
Stefan Matthias Aust  //  Are you ready to discover the twilight zone?



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. add multiple WMF-images to 1 WMF-file

2. copy temporary report wmf.file to permanent wmf

3. Converting PDF files to WMF files

4. How to convert WMF files to RTF files?

5. VW: Interface with CADand WMF-files

6. Printing a report to a WMF file

7. WMF Report file location

8. Moving a .WMF file to a BLOB

9. Found a great way to make WMF files!

10. How do I print a saved WMF File?

11. GPF when linking WMF file

12. WMF files

 

 
Powered by phpBB® Forum Software