Displaying Windows Metafiles

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Displaying Windows Metafiles

Runar Jordahl-3
Does anyone have available code that displays (on screen) a Windows metafile
(WMF file) or enhanced metafile (EMF file)? Would this be easy to do in
Dolphin?



"What is a Windows metafile (WMF file)? - A Windows metafile is a 16-bit
metafile that can be used by Windows 3.x, Windows 95, 98 and Windows NT to
display a picture.



What is an enhanced metafile (EMF file)? -An enhanced metafile is a 32-bit
metafile that can be used by Windows 95, 98 and NT (not Windows 3) to
display a picture. An enhanced metafile can contain a much broader variety
of commands than a "regular" Windows metafile. Basically, the enhanced
metafile format is a 32-bit super-set of the 16-bit Windows metafile
format."



(From http://www.companionsoftware.com/PR/WMRC/WindowsMetafileFaq.html)



Runar Jordahl

http://www.smallwalk.com/


Reply | Threaded
Open this post in threaded view
|

Re: Displaying Windows Metafiles

Chris Uppal-3
Runar Jordahl wrote:

> Does anyone have available code that displays (on screen) a Windows
> metafile (WMF file) or enhanced metafile (EMF file)? Would this be easy
> to do in Dolphin?

You can use an ImagePresenter with its 'Basic view' (an ImageView), and its
value set to an OLEPicture from the file.  E.g.

file := 'whatever.wmf'.
picture := OLEPicture fromFile: file.
ImagePresenter show: 'Basic image' on: picture.

I'm not sure if that works properly with EMF files -- I've only got one, and it
looks a bit odd (but maybe it's meant to).  You can also try the gdiplus
library which has been mentioned in this group before (check the archives
and/or Google), which has a better image viewer (although there seems to be
something strange about the way it thinks that WMF images are much bigger than
everyone else does).

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: Displaying Windows Metafiles

Louis Sumberg-2
Chris Uppal wrote:

> You can use an ImagePresenter with its 'Basic view' (an ImageView), and
its
> value set to an OLEPicture from the file.  E.g.
>
> file := 'whatever.wmf'.
> picture := OLEPicture fromFile: file.
> ImagePresenter show: 'Basic image' on: picture.

FWIW, I too have only one emf file which does not look right when using
OLEPicture>>fromFile:, however it looks fine when using
GdiplusImage>>fromFile: (which makes sense in that Gdiplus has a specific
decoder for emf files).

-- Louis