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
+ Cairo and Pango functions. 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
@@ -40,15 +42,49 @@ for complex clipping regions.
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.
+ with a standard GDK, 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.
+ cdInitContextPlus() once and link to the libraries "cdcairo" and "cairo". Also the Cairo library must be installed in your system.
+ When using the GDK base driver you do not need to link with the "cdcairo"
+ library.
+
In CDLua it is not necessary any additional initialization, and require"cdluacairo" can be used when
+ using dynamic libraries. But when using require there are some restrictions,
+ in Win32 the GDK base driver can NOT be used, in Linux the X11 base driver
+ can NOT be used, and in other UNICES the GDK base driver can NOT be used.
+
+
Extra Drivers (cdcairo.h)
+
Only available in Lua when require"cdluacairo" is
+used.
+
+
CD_CAIRO_PS - PostScript Driver
+
+
Similar to CD_PS, uses the same creation parameters.
+ But margins are not supported and Postscript level can be 2 (parameter -2)
+ or 3 (parameter -3).
+
+
CD_CAIRO_PDF - PDF Driver
+
+
Similar to CD_PDF, uses the same creation
+ parameters. The driver also does not depends on the PDFLib. The additional
+ attributes "OPACITY", "PATTERN", "PDF", "PDFLIBVERSION" and the description
+ strings, are not supported.
+
CD_CAIRO_SVG - Scalable Vector Graphics Driver
+
+
Similar to CD_SVG, uses the same creation
+ parameters. The additional attributes "OPACITY" and "CMD" are not supported.
+
+
CD_CAIRO_IMAGERGB - RGB Client Image Driver
+
+
Similar to CD_IMAGERGB, uses
+ almost the same creation parameters. The main difference is that the
+ data pointers are packed in RGBARGBARGBA... format. So it is used only 1
+ pointer for data, instead of 3. Also the attributes "REDIMAGE",
+ "GREENIMAGE", "BLUEIMAGE" and "ALPHAIMAGE are not supported and replaced by
+ the "RGBDATA" attribute. There are also two new attributes, "STRIDE" that
+ returns the line size in bytes, when data is specified during creation then
+ stride is always width*32. Even when there is not alpha channel, data is
+ stored in 32 bits per pixel. Image data is also organized in top-bottom
+ orientation, it means the data pointer points to the top-left corner.
Behavior of Functions
Control
diff --git a/html/en/drv/gdk.html b/html/en/drv/gdk.html
index 694a22c..e54d6e0 100644
--- a/html/en/drv/gdk.html
+++ b/html/en/drv/gdk.html
@@ -6,11 +6,6 @@
GDK
-
@@ -23,6 +18,9 @@
Pango API
functions. This driver was designed for the GTK+ version 2, and can be
compiled and used in all systems GDK is supported.
+
This is included in the main library in Linux and BSD. To use it in other
+Unices and in Win32 you must link with the cdgdk library
+instead of the cd main library.
This driver allows the generation of a SVG file, a modularized language for
describing two-dimensional vector and mixed vector/raster graphics in XML. The
diff --git a/html/en/drv/xwin.html b/html/en/drv/xwin.html
index 3049da9..86d57ed 100644
--- a/html/en/drv/xwin.html
+++ b/html/en/drv/xwin.html
@@ -21,6 +21,10 @@
implemented in the X-Windows system. The implementation uses the XLIB API
functions. It was developed using X11R4, but works in more recent versions,
such as X11R6.
+
This is included in the main library in AIX, SunOS and IRIX. To use it in
+Linux and BSD you must link with the cdx11 library instead of
+the cd main library.
+
Note: The coordinates internally implemented by the video driver use 16-bit
integers. Therefore, if a coordinate with less than -32k or more than 32k is
defined, it will be interpreted incorrectly.
diff --git a/html/en/guide.html b/html/en/guide.html
index d52c633..b09e2a3 100644
--- a/html/en/guide.html
+++ b/html/en/guide.html
@@ -91,23 +91,29 @@ the makefiles and projects expect the following directory tree:
im\
lua5.1\
Libraries Dependencies
-
cd -> gdi32user32comdlg32 (system - Windows)
- -> X11 (system - UNIX)
- -> FreeType (included as separate library)
-cdgdk -> gdk-win32-2.0(system - Windows)
- -> gdk-x11-2.0 (system - UNIX)
- -> cairo-2 (system - Windows/UNIX)
-cdgdiplus -> cd
+
+ -> cdpdf
+
+(*) In Windows, "cdwin" is called "cd".
+ In Linux and BSD "cdgdk" is called "cd".
+ In IRIX, AIX and SunOS "cdx11" is called "cd".
+
As a general rule (excluding system dependencies and included third party
libraries): CD has NO external dependencies, and CDLua depends on Lua and IMLua.
Just notice that not all CDLua libraries depend on IMLua.
@@ -121,7 +127,8 @@ LUALIB and LUABINDIR definitions before using Tecmake or Tecmake Compact.
libx11-dev
libxpm-dev
libxmu-dev
-libxft-dev
+libxft-dev (for the XRender driver)
+libgtk2.0-dev (for the GDK driver)
New: "CMD", "OPACITY" and "HATCHBOXSIZE"
@@ -43,6 +43,12 @@
Changed:
removed compatibility with require"cdlua51", now LuaBinaries must be used
or LUA_CPATH must be set.
+
+ Changed:
+
+ IMPORTANT - the main library in
+ Linux and BSD is now the GDK base driver. The X11 base driver library
+ was renamed to cdx11 on those systems.
Fixed: PDF driver documentation,
CanvasBackOpacity and CanvasBackground are
diff --git a/include/cdcairo.h b/include/cdcairo.h
index 2d01f2e..f417086 100644
--- a/include/cdcairo.h
+++ b/include/cdcairo.h
@@ -14,7 +14,7 @@ extern "C" {
/* Some of these context can be used directly or by cdInitContextPlus,
as CD_NATIVEWINDOW, CD_IMAGE and CD_DBUFFER.
- The other only directly.
+ The others only directly.
*/
cdContext* cdContextCairoPS(void);
diff --git a/src/cdluacairo5.mak b/src/cdluacairo5.mak
new file mode 100644
index 0000000..691046c
--- /dev/null
+++ b/src/cdluacairo5.mak
@@ -0,0 +1,38 @@
+PROJNAME = cd
+LIBNAME = cdluacairo
+
+OPT = YES
+
+DEFINES = CD_NO_OLD_INTERFACE
+SRCDIR = lua5
+SRC = cdluacairo5.c
+DEF_FILE = cdluacairo5.def
+
+ifneq ($(findstring Win, $(TEC_SYSNAME)), )
+ # In Win32 will work only for the Win32 base driver,
+ # it will NOT work for the GDK base driver.
+ LIBS = cdcairo
+else
+ ifdef GTK_DEFAULT
+ # In Linux will work only for the GDK base driver,
+ # it will NOT work for the X11 base driver.
+ # The main cd library already includes the Cairo driver.
+ LIBS =
+ else
+ # In Other Unices will work only for the X11 base driver,
+ # it will NOT work for the GDK base driver.
+ LIBS = cdcairo
+ endif
+endif
+
+ifdef USE_LUA52
+ LIBNAME := $(LIBNAME)52
+else
+ USE_LUA51 = Yes
+ LIBNAME := $(LIBNAME)51
+endif
+
+NO_LUALINK = Yes
+USE_CD = YES
+USE_CDLUA = YES
+CD = ..
diff --git a/src/config.mak b/src/config.mak
index ec852fb..d9af743 100644
--- a/src/config.mak
+++ b/src/config.mak
@@ -41,7 +41,7 @@ SRC = $(SRCCOMM) $(SRCSVG) $(SRCINTCGM) $(SRCDRV) $(SRCSIM)
ifneq ($(findstring Win, $(TEC_SYSNAME)), )
ifdef USE_GDK
SRC += $(SRCGDK) $(SRCNULL) $(SRCCAIRO)
- LIBNAME := cdgdk
+ LIBNAME := $(LIBNAME)gdk
USE_GTK = Yes
LIBS += cairo
else
@@ -51,10 +51,17 @@ ifneq ($(findstring Win, $(TEC_SYSNAME)), )
else
ifdef USE_GDK
SRC += $(SRCGDK) $(SRCCAIRO)
- LIBNAME := cdgdk
USE_GTK = Yes
LIBS += cairo
+ ifndef GTK_DEFAULT
+ # Build GDK version in IRIX,SunOS,AIX,Win32
+ LIBNAME := $(LIBNAME)gdk
+ endif
else
+ ifdef GTK_DEFAULT
+ # Build X11 version in Linux,Darwin,FreeBSD
+ LIBNAME := $(LIBNAME)x11
+ endif
SRC += $(SRCX11)
USE_X11 = Yes
endif
diff --git a/src/lua5/cdluacairo5.c b/src/lua5/cdluacairo5.c
new file mode 100644
index 0000000..0e99b3c
--- /dev/null
+++ b/src/lua5/cdluacairo5.c
@@ -0,0 +1,108 @@
+/** \file
+ * \brief Cairo Lua 5 Binding
+ *
+ * See Copyright Notice in cd.h
+ */
+
+#include
+#include
+
+#include "cd.h"
+#include "cdcairo.h"
+
+#include
+#include
+
+#include "cdlua.h"
+#include "cdlua5_private.h"
+
+
+static void *cdimagergb_checkdata(lua_State* L, int param)
+{
+ return (void *)luaL_checkstring(L, param);
+}
+
+static cdluaContext cdluaimagergbctx =
+{
+ 0,
+ "CAIRO_IMAGERGB",
+ cdContextCairoImageRGB,
+ cdimagergb_checkdata,
+ NULL,
+ 0
+};
+
+static void *cdps_checkdata( lua_State *L, int param)
+{
+ return (void *)luaL_checkstring(L, param);
+}
+
+static cdluaContext cdluapsctx =
+{
+ 0,
+ "CAIRO_PS",
+ cdContextCairoPS,
+ cdps_checkdata,
+ NULL,
+ 0
+};
+
+static void *cdsvg_checkdata( lua_State *L, int param)
+{
+ return (void *)luaL_checkstring(L, param);
+}
+
+static cdluaContext cdluasvgctx =
+{
+ 0,
+ "CAIRO_SVG",
+ cdContextCairoSVG,
+ cdsvg_checkdata,
+ NULL,
+ 0
+};
+
+static void *cdpdf_checkdata(lua_State *L, int param)
+{
+ return (void *)luaL_checkstring(L, param);
+}
+
+static cdluaContext cdluapdfctx =
+{
+ 0,
+ "CAIRO_PDF",
+ cdContextCairoPDF,
+ cdpdf_checkdata,
+ NULL,
+ 0
+};
+
+static int cdlua5_initcairo(lua_State *L)
+{
+ (void)L;
+ cdInitContextPlus();
+ return 0;
+}
+
+static const struct luaL_reg cdlib[] = {
+ {"InitContextPlus", cdlua5_initcairo},
+ {NULL, NULL},
+};
+
+
+static int cdluacairo_open (lua_State *L)
+{
+ cdluaLuaState* cdL = cdlua_getstate(L);
+ cdInitContextPlus();
+ luaL_register(L, "cd", cdlib); /* leave "cd" table at the top of the stack */
+ cdlua_addcontext(L, cdL, &cdluapdfctx);
+ cdlua_addcontext(L, cdL, &cdluapsctx);
+ cdlua_addcontext(L, cdL, &cdluasvgctx);
+ cdlua_addcontext(L, cdL, &cdluaimagergbctx);
+ return 1;
+}
+
+int luaopen_cdluacairo(lua_State* L)
+{
+ return cdluacairo_open(L);
+}
diff --git a/src/lua5/cdluacairo5.def b/src/lua5/cdluacairo5.def
new file mode 100644
index 0000000..aa12034
--- /dev/null
+++ b/src/lua5/cdluacairo5.def
@@ -0,0 +1,4 @@
+EXPORTS
+ luaopen_cdluacairo
+
+
\ No newline at end of file
diff --git a/src/lua5/cdluapdf5.c b/src/lua5/cdluapdf5.c
index 40877ad..7fd2ece 100644
--- a/src/lua5/cdluapdf5.c
+++ b/src/lua5/cdluapdf5.c
@@ -37,7 +37,11 @@ int cdluapdf_open (lua_State *L)
{
cdluaLuaState* cdL = cdlua_getstate(L);
lua_pushliteral(L, "cd");
+#if LUA_VERSION_NUM > 501
+ lua_pushglobaltable(L);
+#else
lua_gettable(L, LUA_GLOBALSINDEX); /* leave "cd" table at the top of the stack */
+#endif
cdlua_addcontext(L, cdL, &cdluapdfctx);
return 1;
}
--
cgit v1.2.3