CD - Canvas Draw

CD_CLIPBOARD - Clipboard Driver (cdclipbd.h)

This driver allows the access to a Clipboard area. It is greatly dependent on the system. In Win32, it creates an Enhanced Metafile, a Bitmap or a CD Metafile; in X-Windows it creates only a CD Metafile.


The canvas is created by means of a call to function cdCreateCanvas(CD_CLIPBOARD, Data), after which other functions in the CD library can be called as usual. The Data parameter string is platform-dependent and varies according to the metafile created. See each metafile's documentation, but remember to exclude parameter "filename".

In the Windows environment, if the string "-b" is present, it means that a Bitmap must be created instead of a metafile, and, if the string "-m" is specified, a CD Metafile will be created. For a Bitmap the remaining string must contains the bitmap size and optionally its resolution: "-b widthxheight [resolution]" or in C "%dx%d %g", the resolution default is the screen resolution.

In the X-Windows environment, the Display ("%p") where the data will be stored must be passed as a parameter before the CD Metafile parameters. This environment's driver is used only for applications that use CD to communicate with each other, because only CD Metafiles are created.

Any amount of such canvases may exist simultaneously. It is important to note that a call to function cdKillCanvas is required to properly copy the data to the Clipboard.

You can interpret the data from the Clipboard using function cdPlay. In the X-Windows environment, the parameter "data" for the cdPlay function is the pointer to the Display where the metafile will be obtained. The cdRegisterCallback must be called for the driver that will interpret the file, except for bitmaps that the CD_CLIPBOARD driver must be used.

To use this driver in Windows using GDI+ is necessary to call cdUseContextPlus(1) before creating the canvas.

Behavior of Functions

This driver is greatly platform-dependent. For further detail, see the Behavior of Functions in each platform: Microsoft Windows (GDI), X-Windows (XLIB). However, it should be noted that some functions behave differently from the basic functions of each platform.