CAIRO Base Driver

This driver represents a basic driver for all system-dependent drivers implemented in the X-Windows and MS-Windows systems. The implementation uses the Cairo API functions and Pango functions to support Unicode text. This driver can be compiled and used in all systems Cairo is supported. The drivers Native Window, Image, Printer and Double Buffer were implemented.

The main motivation for the use of Cairo was transparency for all the primitives. Beyond that we got other features like anti-aliasing, gradient filling, transformations and back-ends (support to rendering: PDF, PS, SVG and PNG surfaces).

This driver still does not completely replace the X-Windows and GDI Windows base drivers, because Cairo does not have support for bitwise XOR operations and for complex clipping regions.

So we let the programmer to choose what to use. We created the function cdUseContextPlus that allows to activate or to deactivate the use of Cairo for the available GDK, Win32 or X-Windows based drivers. This function affects only the cdCreateCanvas function call, once created the canvas will be always a Cairo canvas. In fact the function affects primary the definitions CD_NATIVEWINDOW, CD_IMAGE and CD_DBUFFER, because they are function calls and not static defines.

Using Cairo it is allowed to create more that one canvas at the same time for the same Window. And they can co-exist with a standard GD, Win32 or X-Windows canvas.

To enable the use of Cairo based drivers you must call the initialization function cdInitContextPlus() once and link to the libraries "cdcairo" and "cairo". When using the GDK base driver you do not need to link with the "cdcairo" library. Also the Cairo library must be installed in your system.

In CDLua it is not necessary any additional initialization, but the application must still be linked with the cdcontextplus.lib library or a require"cdluacontextplus" can be used when using dynamic libraries.

Behavior of Functions

Control 

Coordinate System and Clipping

Primitives

Attributes

Colors

Exclusive Attributes