W
Wil Stark
I'm trying to use .emf files exported from Visio as content within a C++
executable that I am writing.
The problem is, when I play back the .emf in my EXE, the Visio generated
..emf files don't completely fill the bounding rectangle, but instead only
fills about 90-95% of it. According to MSDN docs, I expect that when a
metafile is played back, that it will stretch to fill the bounding
rectangle, and be at least within one pixel of it (some allowance give for
rounding/scaling errors). What I see is that the extra space around the
rendered .emf varies with the size given for the bounding rectangle (it is
not a constant number of pixels). Also, the scaling factor seems to be
different for different .emf files. Because of this, it is difficult to
determine where exactly my .emf file will show up in my output window.
I'm using GDI+ to playback the metafile with code that looks something like
this:
Gdiplus::Metafile mf ( hEnhMetaFile );
Gdiplus::Graphics gr( hDC );
Gdiplus::Rect rect( 0, 0, 100, 100 );
gr.DrawImage( &mf, rect );
Instead of the rendered metafile filling the 100x100 space, it fills only
(say) 94x94 with a 3 pixel border around each side. Note that the same
result occurs when rendering with GDI, but I tried GDI+ after reading KB
article 893473.
I've examined the metafile records under the debugger, and even for a simple
square shape there are a couple dozen, including (apparently) calls to
ModifyWorldTransform, indicating to me that something is more complicated
about the Visio exported files and is the source of the problem.
Can anyone comment on whether there is some sort of modification that needs
to be made to get Visio generated .emf files to fill the bounding rectangle
when played back with GDI+?
Also, can anyone recommend a good editor that can save to EMF format (that
doesn't have this problem that Visio seems to have)?
For the record, I can generate my own square shape (in C++ code calling GDI)
and save to an .emf file, and play it back using the above code, and it
fills the bounding rectangle properly.
Thanks,
Wil
executable that I am writing.
The problem is, when I play back the .emf in my EXE, the Visio generated
..emf files don't completely fill the bounding rectangle, but instead only
fills about 90-95% of it. According to MSDN docs, I expect that when a
metafile is played back, that it will stretch to fill the bounding
rectangle, and be at least within one pixel of it (some allowance give for
rounding/scaling errors). What I see is that the extra space around the
rendered .emf varies with the size given for the bounding rectangle (it is
not a constant number of pixels). Also, the scaling factor seems to be
different for different .emf files. Because of this, it is difficult to
determine where exactly my .emf file will show up in my output window.
I'm using GDI+ to playback the metafile with code that looks something like
this:
Gdiplus::Metafile mf ( hEnhMetaFile );
Gdiplus::Graphics gr( hDC );
Gdiplus::Rect rect( 0, 0, 100, 100 );
gr.DrawImage( &mf, rect );
Instead of the rendered metafile filling the 100x100 space, it fills only
(say) 94x94 with a 3 pixel border around each side. Note that the same
result occurs when rendering with GDI, but I tried GDI+ after reading KB
article 893473.
I've examined the metafile records under the debugger, and even for a simple
square shape there are a couple dozen, including (apparently) calls to
ModifyWorldTransform, indicating to me that something is more complicated
about the Visio exported files and is the source of the problem.
Can anyone comment on whether there is some sort of modification that needs
to be made to get Visio generated .emf files to fill the bounding rectangle
when played back with GDI+?
Also, can anyone recommend a good editor that can save to EMF format (that
doesn't have this problem that Visio seems to have)?
For the record, I can generate my own square shape (in C++ code calling GDI)
and save to an .emf file, and play it back using the above code, and it
fills the bounding rectangle properly.
Thanks,
Wil