A metafile should conform to the standards specified in sections 9.10, 9.10.1, and 9.10.2 of the Microsoft Windows Software Development Kit: Windows Programming Guide. The following pages highlight the specific restrictions on metafile contents and GDI calls in metafile pictures that will be imported into PageMaker must adhere.
Metafiles must adhere to these standards regarding their content(see section 9.10.1 of the Programming Guide):
Metafile pictures may not use SetClipRGn or OffsetRgn calls.
The metafile should not contain calls to SetViewportOrg or SetViewportExt.These calls work in device units and represent alteration by the metafile of its permitted drawing area on the screen.
Additional restrictions on specific GDI calls in metafile pictures are described in the Windows Programming Guide, section 9.10.2, and highlighted below:
The Escape call is not permitted. Its use may have drastic side effects.
SelectClipRgn and OffsetClipRgn are not permitted.
Do not use BitBlt to draw a bitmap. BitBlt does not scale and introduces a device dependent component to the size of the picture. If there is a bit-map in the metafile, use StretchBlt. StretchBlt will scale the bit-map as the metafile is scaled. If you use BitBlt, the bit-map will not get scaled.
SaveDC and RestoreDC should be balanced within a metafile; that is every SaveDC call should be followed by a RestoreDC call. Each Restore DC call should restore a display context that was saved within the metafile; use restore relatives, for example RestoreDC (hDC,-1).
Do not use PrintRgn, InvertRgn, FrameRgn, or FillRgn calls in a metafile. Any metafile picture using these calls has a device-dependent size.
When using the SelectObject function, care should be taken when selecting devicedependent objects such as bit-maps and pattern brushes.
The following GDI calls can be used in any metafile:
MoveTo GetCurrentPosition
LineTo PolyLine
Rectangle RoundRect
Polygon Ellipse
Arc Pie
FloodFill InvertRec
TextOut PatBlt
SetPolyFillMode SetStretchBltMode
SetRob2 SetColorTable
SetBkColor SetRelAbs
Additionally, metafiles for PageMaker import should adhere to these guidelines:
No mapping modes should be set. PageMaker needs to display the metafile in different sizes and at different resolutions. The user may stretch the image into a different aspect ratio. None of this is possible if the map mode, the viewport, or the window is set. Therefore, do not call the following functions in the metafile:
SetMapMode, SetViewportExt, SetViewportOrg, SetWindOrg, SendWindExt.
FrameRect and FillRect may be used, but be aware that they use pattern brushes that are device-dependent. Patterns on pattern brushes will get compacted for high resolution printers because they have a bit-per-pixel representation. Import filters should do a full monochrome import; there should be no color brushes, as these brushes are device-dependent.
The measurement system of the metafile should be the same as the source image measurement system. If the range of the source coordinates is greater than 32,767 (MAXSHORT), or if the range is very small, then an appropriate scale factor should be applied to stay within range and to minimize granularity.
This initial size of the metafile image will be computed using pPict->inch. The computed size of the image should be the same as the physical size of the source image. If the source image is of a very large or a very small object (such as a building or an IC), then pPict->inch should be scaled. Use a factor that would normally be used to display the image. In no case should the computed size be larger than 22.75 by 22.75 inches (32K TWIPS), nor smaller than a postage stamp. When calculating the bounds of the image, (pPict->bbox), be sure to include the width of the lines at the edge of the picture. If you do not account for the line thickness, lines will be cropped out of a picture by the display code. This generally means that you must add half the line width of border objects; add round-off errors to bottom and right edges.