Board index » delphi » TPW 1.5 : displaying Windows Metafiles

TPW 1.5 : displaying Windows Metafiles

David Van Bedaf asked me to post this message.

I'm confronted with a few problems regarding displaying existing
WMF-files stored on disk.

- How can I define the dimensions of the rectangle in which to display
the WMF ? I can see no possibilities when looking at 'TMetaHeader'.
- Same question for the mapping mode to use.
- What about 'placeable Metafiles' ? How to read the additional
header, which is said to have a field 'bbox' with the coordinates of
the rectangle that encloses the picture ?

- How can I know whether the WMF-file I'm loading is a normal metafile
or a placeable metafile ? The 'GetMetaFile' function isn't compatible
with these placeable metafiles, hence the problem. To display these
metafiles I have to strip the 22 byte header and create a standard WMF
using 'SetMetaFileBits' with the remaining bytes. I haven't succeeded
yet, however.
- How can I stretch the WMF to chosen dimensions (e.g. full screen)?

The code I'm using at the moment looks like this

case message of
wm_Paint:
begin
  hDevC := BeginPaint(hWindow, ps);
  hMF := GetMetaFile(mfName);
  SetMapMode (hDevC, MM_HIMETRIC); (*just a wild guess*)
  PlayMetaFile (hDevC, hMF);
  EndPaint(hWindow, ps);
end;

Any suggestions to get me on the right track are welcome.

--

------------------------------Dr. Brigitte
Verdonk------------------------------
Dept. of Math. and Comp. Sc.                        Tel.  +32 3
820.24.03
University of Antwerp (UIA)                         Fax.  +32 3 820.24.21
Universiteitsplein 1    
B2610 Wilrijk-Antwerp (Belgium)                     Email: verd...@uia.ua.ac.be
--------------------------------------------------------------------------------

 

Re:TPW 1.5 : displaying Windows Metafiles


In article <322D45A3....@uia.ua.ac.be>,
"Brigitte.Verdonk" <verd...@uia.ua.ac.be> says:

Quote
>David Van Bedaf asked me to post this message.
>I'm confronted with a few problems regarding displaying existing
>WMF-files stored on disk.

Well... a long time has past since I've dealt with Metafiles...
And my application didn't show metafiles (It created placeable metafiles).

Quote
>- How can I define the dimensions of the rectangle in which to display
>the WMF ? I can see no possibilities when looking at 'TMetaHeader'.

SetViewportOrg / SetViewportExt. The metafile should do SetWindowOrg/
SetWindowExt. (Maybe it's the other way around!)

Quote
>- Same question for the mapping mode to use.

Only one mapping mode supports the APIs above, I believe it is
MM_ANISOTROPIC.

Quote
>- What about 'placeable Metafiles' ? How to read the additional
>header, which is said to have a field 'bbox' with the coordinates of
>the rectangle that encloses the picture ?

I believe bbox describes the rectangle enclosing the picture,
in the coordinate system of the metafile.

Quote
>- How can I know whether the WMF-file I'm loading is a normal metafile
>or a placeable metafile ? The 'GetMetaFile' function isn't compatible

The original metafile format was designed as a fast redraw for
applications. It wasn't suitable for exchanging metafiles between
programs or machines, so the placeable metafile format was defined.
Your application should be able to interprete placeable metafiles.

Quote
>with these placeable metafiles, hence the problem. To display these
>metafiles I have to strip the 22 byte header and create a standard WMF
>using 'SetMetaFileBits' with the remaining bytes. I haven't succeeded
>yet, however.

Sorry - no experience here.

Quote
>- How can I stretch the WMF to chosen dimensions (e.g. full screen)?

Change the viewport - see above.

Good luck,
Zweitze.

-----------------------------------------------------------------------
  Zweitze de Vries                           zwei...@cyco.nl
  Cyco Software Development
  Handelskade 49
  Rijswijk, Netherlands                      (+31) 70 3954179

Other Threads