CD_EMF - Enhanced Metafile Driver (cdemf.h)

This driver allows generating a Microsoft Windows Enhanced Metafile, the format used by 32-bit Windows systems to store graphics primitives. Usually, the filename has an extension "*.emf".

The driver works only with the GDI, GDI+ and Cairo base drivers, but you can use it in other platforms without the risk of compilation error. If you attempt to create a canvas in another platform, function cdCreateCanvas will return NULL.


The canvas is created by means of a call to function cdCreateCanvas(CD_EMF, Data), after which other CD functions can be called as usual. Parameter Data has the following format:

"filename widthxheight [resolution]"     or in C "%s %dx%d %g"

It must include the filename and the canvas' dimensions. The filename must be inside double quotes (") if it has spaces. Width and height are provided in pixels (note the lowercase "x" between them). Resolution is the number of pixels per millimeter; its default value is the screen resolution.

Any amount of such canvases may exist simultaneously. Function cdCreateCanvas opens the file, and a call to function cdKillCanvas is required to close the file properly.

Behavior of Functions

This driver is very platform-dependent and depends on the base driver used. But the functions bellow behave differently.

For further detail, see the Behavior of Functions in each base driver: GDI. To use this driver with a context plus base driver is necessary to call cdUseContextPlus(1) before creating the canvas, see the GDI+ and Cairo base drivers. This driver is NOT available for the other base drivers.

It has been noticed that EMFs, when saved in the Windows 9x environment, is not totally compatible with EMFs saved in the Windows NT environment.

If you intend to use cdCanvasPlay to interpret the EMF, then do not use GDI+ to generate the metafile. GDI+ extensively use internal transformations that will affect the cdCanvasPlay interpretation. Also some interior style will not be correctly interpreted.

Control Functions

Client Images 

Server Images