This driver provides access to an existing Native Window, a basic element of the user-interface system. It also provides access to other native handles like HDC handles in Windows.
The canvas is created by means of a call to the function cdCreateCanvas(CD_NATIVEWINDOW, Data), after which other functions in the CD library can be called as usual. This function creates a CD canvas based on an existing system canvas. The parameter Data is a pointer to a handle of the canvas. It is system-dependent, having a different meaning in each platform:
Direct2D, GDI and GDI+: can be the handle of the Windows window (HWND),
or the handle of a previously created Device Context (HDC), or can be a string in the
format "hdc width height" or, in C, "%p %d %d".
To get the entire screen use a NULL data.
X-Windows: is a string in the format "display window" or, in C, "%p %lu" (uses the default screen).
GDK and Cairo: is a GdkDrawable* or GdkWindow* handle.
The given parameters must exists until cdKillCanvas is called. In Windows, the HDC is released only if created inside cdCreateCanvas from an HWND or when data is NULL.
Any amount of such canvases may exist simultaneously, but they should not use the same window, except if you are using a GDI canvas and a GDI+ canvas at the same time for the same window.
In CDLUA, the creation parameter must be a string in X-Windows and a userdata in others.
Equivalent to function cdCanvasGetSize, but returns the values relative to the main screen of the window system. It is not necessary to have an active canvas to call this function.
Equivalent to function cdCanvasGetColorPlanes, but returns the value relative to the main screen of the window system. It is not necessary to have an active canvas to call this function.
This driver is very platform-dependent and depends on the base driver used.
For further detail, see the Behavior of Functions in each base driver: GDI, GDK and X-Win. To use this driver with a context plus base driver is necessary to call cdUseContextPlus(1) before creating the canvas, see the Direct2D, GDI+, Cairo and XRender base drivers.