diff options
author | scuri <scuri> | 2010-06-10 20:17:50 +0000 |
---|---|---|
committer | scuri <scuri> | 2010-06-10 20:17:50 +0000 |
commit | 2fb345fc972465ade03cc1d527ad3c8db3438ac5 (patch) | |
tree | 3fd9b1f7e2b12fd79c2000c0f305e8ef7763364a | |
parent | c5f7b4e29afdd70a0f05d8785619585a45916b27 (diff) |
*** empty log message ***
-rw-r--r-- | html/en/drv/cairo.html | 56 | ||||
-rw-r--r-- | html/en/drv/gdk.html | 8 | ||||
-rw-r--r-- | html/en/drv/svg.html | 2 | ||||
-rw-r--r-- | html/en/drv/xwin.html | 4 | ||||
-rw-r--r-- | html/en/guide.html | 27 | ||||
-rw-r--r-- | html/en/history.html | 8 | ||||
-rw-r--r-- | include/cdcairo.h | 2 | ||||
-rw-r--r-- | src/cdluacairo5.mak | 38 | ||||
-rw-r--r-- | src/config.mak | 11 | ||||
-rw-r--r-- | src/lua5/cdluacairo5.c | 108 | ||||
-rw-r--r-- | src/lua5/cdluacairo5.def | 4 | ||||
-rw-r--r-- | src/lua5/cdluapdf5.c | 4 |
12 files changed, 242 insertions, 30 deletions
diff --git a/html/en/drv/cairo.html b/html/en/drv/cairo.html index 2e04833..adb65ac 100644 --- a/html/en/drv/cairo.html +++ b/html/en/drv/cairo.html @@ -10,6 +10,9 @@ .style1 { font-family: Courier; } +.style3 { + text-decoration: underline; +} </style> </head> @@ -19,8 +22,7 @@ <p>This driver represents a basic driver for all system-dependent drivers implemented in the X-Windows and MS-Windows systems. The implementation uses the - <a href="http://library.gnome.org/devel/pango/">Cairo</a> API - functions and Pango functions to support Unicode text. This driver can be + <a href="http://library.gnome.org/devel/pango/">Cairo</a> and Pango functions. This driver can be compiled and used in all systems Cairo is supported. The drivers <b>Native Window</b>, <b>Image</b>, <b>Printer</b> and <b>Double Buffer</b> were implemented.</p> <p>The main motivation for the use of Cairo was transparency for all the @@ -40,15 +42,49 @@ for complex clipping regions.</p> <span style="font-family: Courier">CD_DBUFFER</span></strong>, because they are function calls and not static defines.</p> <p>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.</p> + with a standard GDK, Win32 or X-Windows canvas.</p> <p>To enable the use of Cairo based drivers you must call the initialization function <font face="Courier"><strong> - cdInitContextPlus()</strong></font> once and link to the libraries "<strong>cdcairo</strong>" and "<strong>cairo</strong>". - When using the GDK base driver you do not need to link with the "<strong>cdcairo</strong>" - library. Also the Cairo library must be installed in your system.</p> - <p>In CDLua it is not necessary any additional initialization, but the - application must still be linked with the <strong>cdcontextplus.lib</strong> - library or a <strong>require"cdluacontextplus"</strong> can be used when - using dynamic libraries.</p> + cdInitContextPlus()</strong></font> once and link to the libraries "<strong>cdcairo</strong>" and "<strong>cairo</strong>". Also the Cairo library must be installed in your system. + When using the GDK base driver you do not need to link with the "<strong>cdcairo</strong>" + library. </p> + <p>In CDLua it is not necessary any additional initialization, and <strong>require"cdluacairo"</strong> 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.</p> + +<h3>Extra Drivers (cdcairo.h)</h3> +<p>Only available in Lua when <strong>require"cdluacairo"</strong> is +used.</p> + +<h4>CD_CAIRO_PS - PostScript Driver</h4> + + <p>Similar to <a href="ps.html">CD_PS</a>, uses the same creation parameters. + But margins are not supported and Postscript level can be 2 (parameter -2) + or 3 (parameter -3).</p> + +<h4>CD_CAIRO_PDF - PDF Driver</h4> + + <p>Similar to <a href="pdf.html">CD_PDF</a>, 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.</p> +<h4>CD_CAIRO_SVG - Scalable Vector Graphics Driver</h4> + + <p>Similar to <a href="svg.html">CD_SVG</a>, uses the same creation + parameters. The additional attributes "OPACITY" and "CMD" are not supported.</p> + +<h4>CD_CAIRO_IMAGERGB - RGB Client Image Driver</h4> + + <p>Similar to <a href="irgb.html">CD_IMAGERGB</a>, uses <span class="style3"> + almost</span> 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.</p> <h3>Behavior of Functions</h3> <h4>Control </h4> 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 @@ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>GDK</title> <link rel="stylesheet" type="text/css" href="../../style.css"> -<style type="text/css"> -.style1 { - font-family: monospace; -} -</style> </head> <body> @@ -23,6 +18,9 @@ <a href="http://library.gnome.org/devel/pango/">Pango</a> API functions. This driver was designed for the GTK+ version 2, and can be compiled and used in all systems GDK is supported.</p> +<p>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 <strong>cdgdk</strong> library +instead of the <strong>cd</strong> main library.</p> <h3>Behavior of Functions</h3> <h4>Control </h4> diff --git a/html/en/drv/svg.html b/html/en/drv/svg.html index 10a0952..31a5f4a 100644 --- a/html/en/drv/svg.html +++ b/html/en/drv/svg.html @@ -10,7 +10,7 @@ <body> -<h2 style="text-align: left">CD_SVG - CD Scalable Vector Graphics Driver (cdsvg.h)</h2> +<h2 style="text-align: left">CD_SVG - Scalable Vector Graphics Driver (cdsvg.h)</h2> <p>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.</p> +<p>This is included in the main library in AIX, SunOS and IRIX. To use it in +Linux and BSD you must link with the <strong>cdx11</strong> library instead of +the <strong>cd</strong> main library.</p> + <p>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.</p> 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:</p> im\ lua5.1\</pre> <h4>Libraries Dependencies</h4> -<pre>cd -> <strong><span class="style4">gdi32</span></strong> <strong><span class="style4">user32</span></strong> <strong><span class="style4">comdlg32</span></strong> (system - Windows) - -> <strong><span class="style4">X11</span></strong> (system - UNIX) - -> <strong><span class="style2">FreeType</span></strong> (included as separate library) -cdgdk -> <strong><span class="style1">gdk-win32-2.0</span></strong>(system - Windows) - -> <strong><span class="style1">gdk-x11-2.0</span></strong> (system - UNIX) - -> <span class="style1"><strong>cairo-2</strong></span> (system - Windows/UNIX) -cdgdiplus -> cd +<pre>cd -> <strong><span class="style2">FreeType</span></strong> (included as separate library) +<em> cdwin*</em> -> <strong><span class="style4">gdi32</span></strong> <strong><span class="style4">user32</span></strong> <strong><span class="style4">comdlg32</span></strong> (system - Windows) +<em> cdx11*</em> -> <strong><span class="style4">X11</span></strong> (system - UNIX) +<em> </em><em>cdgdk</em><em>*</em> -> <strong><span class="style1">gdk-win32-2.0 pangowin32-1.0</span></strong>(system - Windows) +<em> </em> -> <strong><span class="style1">gdk-x11-2.0</span></strong> <strong><span class="style1">pangox-1.0 </span></strong>(system - UNIX) + -> <span class="style1"><strong>cairo-2 </strong></span><strong><span class="style1">gdk_pixbuf-2.0 pango-1.0 gobject-2.0</span></strong> <strong><span class="style1">gmodule-2.0 glib-2.0</span></strong> (system - Windows/UNIX) +<em>cdgdiplus*</em> -> cd -> <strong><span class="style4">gdiplus</span></strong> (system - Windows) -cdxrender -> cd +<em>cdxrender*</em> -> cd -> <strong><span class="style4">Xrender</span></strong> <strong><span class="style4">Xft</span></strong> (system - UNIX) +<em>cdcairo*</em> -> <span class="style1"><strong>cairo-2</strong></span> (system - Windows/UNIX) cdpdf -> <strong><span class="style2">pdflib</span></strong> (included as separate library) cdlua51 -> cd -> <strong><span class="style3">lua5.1</span></strong> cdluaim51 -> cdlua51 -> <strong><span class="style3">imlua51</span></strong> cdluapdf51 -> cdlua51 - -> cdpdf</pre> + -> cdpdf + +(*) In Windows, "<strong>cdwin</strong>" is called "<strong>cd</strong>". + In Linux and BSD "<strong>cdgdk</strong>" is called "<strong>cd</strong>". + In IRIX, AIX and SunOS "<strong>cdx11</strong>" is called "<strong>cd</strong>".</pre> + <p>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.</p> @@ -121,7 +127,8 @@ LUALIB and LUABINDIR definitions before using Tecmake or Tecmake Compact.</p> <pre>libx11-dev libxpm-dev libxmu-dev -libxft-dev</pre> +libxft-dev (for the XRender driver) +libgtk2.0-dev (for the GDK driver)</pre> <h3><a name="Environment">Environment Variables</a></h3> diff --git a/html/en/history.html b/html/en/history.html index 1f693f1..1b1ac36 100644 --- a/html/en/history.html +++ b/html/en/history.html @@ -24,7 +24,7 @@ <body> <h2>History of Changes</h2> -<h3><a href="http://sourceforge.net/projects/canvasdraw/files/5.4/">Version 5.4</a> (XX/XX/2010)</h3> +<h3><a href="http://sourceforge.net/projects/canvasdraw/files/5.4/">Version 5.4</a> (XX/June/2010)</h3> <ul> <li><span class="hist_new">New:</span> context plus driver Cairo.</li> <li><span class="hist_new">New:</span> "CMD", "OPACITY" and "HATCHBOXSIZE" @@ -43,6 +43,12 @@ <span class="hist_changed">Changed:</span> removed compatibility with require"cdlua51", now LuaBinaries must be used or LUA_CPATH must be set.</li> + <li dir="ltr"> + <span class="hist_changed">Changed:</span> + <strong> + <span style="color: #FF0000">IMPORTANT</span></strong> - the main library in + Linux and BSD is now the GDK base driver. The X11 base driver library + was renamed to <strong>cdx11</strong> on those systems.</li> <li> <span class="hist_fixed">Fixed:</span> PDF driver documentation, <strong>CanvasBackOpacity</strong> and <strong>CanvasBackground</strong> 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 <stdlib.h> +#include <stdio.h> + +#include "cd.h" +#include "cdcairo.h" + +#include <lua.h> +#include <lauxlib.h> + +#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; } |