CD - Canvas Draw

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 in the Microsoft Windows platform, 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"     or in C "%s %dx%d"

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 (the number of pixels per millimeter) is always 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.

To use this driver in Windows using GDI+ is necessary to call cdUseContextPlus(1) before creating the canvas. 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.

Behavior of Functions

This driver is greatly platform-dependent. For further detail, see the Behavior of Functions of the Microsoft Windows (GDI) or Windows Using GDI+ platform base drivers. It has been noticed that EMF, when saved in the Windows 95 environment, is not totally compatible with EMF saved in the Windows NT environment.

Control Functions

  • Play: different from the basic driver, is implemented. Not implemented using GDI+.
  • Clear: different from the basic driver, does nothing.

Client ImagesĀ 

Server Images

  • All functions do nothing.