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 some GTK functions to support Unicode text. This driver can be
- compiled and used in all systems Cairo is supported.
+ 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
@@ -24,6 +30,25 @@ 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
@@ -39,6 +64,13 @@ for complex clipping regions.
UpdateYAxis: the
orientation of axis Y is the opposite to its orientation in the CD library.
+
@@ -103,6 +135,12 @@ for complex clipping regions.
background color).
+
+
"PATTERNIMAGE": defines
+ a filled interior style using a server image as pattern. Data must be a server
+ image handle created with he Cairo base driver.
+
+
"POLYHOLE": defines the index of
the vertex where there is a hole in a closed polygon. It will affect the next
diff --git a/html/en/drv/gdiplus.html b/html/en/drv/gdiplus.html
index f5b89f4..41e72dd 100644
--- a/html/en/drv/gdiplus.html
+++ b/html/en/drv/gdiplus.html
@@ -61,7 +61,8 @@
Pixel:
uses GDI. Excepting when the canvas is an image so it is done using GDI+.
Sector:
it also draws an arc in the same position to complete the size of the sector.
@@ -77,7 +78,8 @@
CD_FILLGRADIENT defines the points of a filled polygon. It is filled with a gradient from
colors in each vertex to a color in its center. The colors are defined by the "GRADIENTCOLOR"
attribute, that must be set before each cdVertex call and before cdEnd
- for the center color. This will not affect the current interior style.
+ for the center color. This will not affect the current interior style.
+ CD_PATH is supported.
diff --git a/html/en/drv/svg.html b/html/en/drv/svg.html
index 10a0952..af703a5 100644
--- a/html/en/drv/svg.html
+++ b/html/en/drv/svg.html
@@ -76,6 +76,9 @@
Pixel:
does not exist in SVG, is simulated using a circle with radius=0.1.
Returns the given color coded with the alpha information. ATENTION: At the
- moment only the Win32 with GDI+, the
- XRender and the IMAGERGB
+ moment only the Cairo,
+ GDI+, XRender
+ and IMAGERGB
drivers support alpha components in color coding. The
internal representation of the component is inverted, because the default value
must be 0 and opaque for backward compatibility, so you should use the cdDecodeAlpha
diff --git a/html/en/func/init.html b/html/en/func/init.html
index 9cdee9e..32a1ab6 100644
--- a/html/en/func/init.html
+++ b/html/en/func/init.html
@@ -41,7 +41,9 @@ cd.CreateCanvas(ctx: number, data: string or userdata) -> (canvas: cdCanvas)
Initializes the context driver to use another context replacing the standard drivers.
This functions is only available when a library containing a "ContextPlus"
-context driver is used. See the GDI+ base
-driver and the XRender base driver.
+context driver is used. See the Cairo, GDI+
+and XRender base drivers.
In Lua, when using require"cdluacontextplus" this function will be
automatically called.
Configures the pixel (x,y) with the color defined by color. It is the smallest element of the canvas. It depends only
- on global attributes of the canvas.
+ on global attributes of the canvas. It can be very slow on some drivers.
+ Sometimes it is implemented as a rectangle with size 1x1.
+"PATH": allows to create
+ a complex path using CD primitives and then fill, stroke or clip using the
+ new path. Must be used with the following parameters:
+
"BEGIN" - creates a new empty path, must be the first call
+
cdCanvasPixel, cdCanvasLine, cdCanvasArc - add elements to the path
+ instead of drawing to the canvas
+
"FILL" - closes the path, and fills it with the current fill attributes,
+ then the path is discarded
+
"STROKE" - strokes the path with the current line attributes, then the
+ path is discarded
+
"CLOSESTROKE" - closes the path, and strokes it with the current line
+ attributes, then the path is discarded
+
"FILLSTROKE" - closes the path, and fills it with the current fill
+ attributes, strokes the path with the current line attributes, then the path
+ is discarded
+
"CLIP" - closes the path, and use it as a clipping area to be
+ intersected with the current clipping area, then the path is discarded
+
"NULL" - discards the path and ends the process without any output.
+
ARC - If there is a current point an additional straight line is drawn
+ from the current point to the starting point of the arc. The endpoint of the
+ arc becomes the new current point.