summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorscuri <scuri>2009-12-02 20:30:55 +0000
committerscuri <scuri>2009-12-02 20:30:55 +0000
commit0a186150f085c34462b8c6cd5257849c73f80b65 (patch)
treef78781174c5f64d032efa0760a0ac06af8f8447b /src
parent3914ec6505021df1b3edac7a0b2648ace33e4ef4 (diff)
New: driver SVG.
Diffstat (limited to 'src')
-rw-r--r--src/cd.def1
-rw-r--r--src/config.mak5
-rw-r--r--src/lua3/cdluactx.c24
-rw-r--r--src/lua5/cdlua5ctx.c22
4 files changed, 50 insertions, 2 deletions
diff --git a/src/cd.def b/src/cd.def
index 61ac5cf..004538b 100644
--- a/src/cd.def
+++ b/src/cd.def
@@ -15,6 +15,7 @@ EXPORTS
cdContextDBufferRGB
cdContextPicture
cdContextDebug
+ cdContextSVG
cdRedImage
cdGreenImage
diff --git a/src/config.mak b/src/config.mak
index 5465a06..05b5182 100644
--- a/src/config.mak
+++ b/src/config.mak
@@ -4,6 +4,9 @@ OPT = YES
DEFINES = CD_NO_OLD_INTERFACE
+SRCSVG = base64.c lodpng.c cdsvg.c
+SRCSVG := $(addprefix svg/, $(SRCSVG))
+
SRCINTCGM = circle.c ellipse.c intcgm1.c \
intcgm2.c intcgm4.c intcgm6.c list.c \
sism.c tparse.c bparse.c
@@ -27,7 +30,7 @@ SRCNULL := $(addprefix drv/, $(SRCNULL))
SRCCOMM = cd.c wd.c wdhdcpy.c rgb2map.c cd_vectortext.c cd_active.c \
cd_attributes.c cd_bitmap.c cd_image.c cd_primitives.c cd_text.c cd_util.c
-SRC = $(SRCCOMM) $(SRCINTCGM) $(SRCDRV) $(SRCSIM)
+SRC = $(SRCCOMM) $(SRCSVG) $(SRCINTCGM) $(SRCDRV) $(SRCSIM)
ifneq ($(findstring Win, $(TEC_SYSNAME)), )
SRC += $(SRCWIN32)
diff --git a/src/lua3/cdluactx.c b/src/lua3/cdluactx.c
index fc09313..1ddd8e6 100644
--- a/src/lua3/cdluactx.c
+++ b/src/lua3/cdluactx.c
@@ -24,6 +24,7 @@
#include "cdclipbd.h"
#include "cdmf.h"
#include "cdps.h"
+#include "cdsvg.h"
#include "cddbuf.h"
#include "cdgdiplus.h"
@@ -779,6 +780,28 @@ static cdContextLUA cdluapsctx =
};
/***************************************************************************\
+* CD_SVG. *
+\***************************************************************************/
+static void *cdsvg_checkdata(int param)
+{
+ lua_Object data = lua_getparam(param);
+ if (!lua_isstring(data))
+ lua_error("cdCreateCanvas CD_SVG: data should be of type string!");
+
+ return lua_getstring(data);
+}
+
+static cdContextLUA cdluasvgctx =
+{
+ 0,
+ "CD_SVG",
+ cdContextSVG,
+ cdsvg_checkdata,
+ NULL,
+ 0
+};
+
+/***************************************************************************\
* CD_PRINTER. *
\***************************************************************************/
static void *cdprinter_checkdata(int param)
@@ -940,6 +963,7 @@ void cdlua_initdrivers(void)
cdlua_addcontext(&cdluacgmctx);
cdlua_addcontext(&cdluamfctx);
cdlua_addcontext(&cdluapsctx);
+ cdlua_addcontext(&cdluasvgctx);
cdlua_addcontext(&cdluaclipboardctx);
cdlua_addcontext(&cdluanativewindowctx);
cdlua_addcontext(&cdluaprinterctx);
diff --git a/src/lua5/cdlua5ctx.c b/src/lua5/cdlua5ctx.c
index e3bd19e..4d97f3b 100644
--- a/src/lua5/cdlua5ctx.c
+++ b/src/lua5/cdlua5ctx.c
@@ -1,5 +1,5 @@
/***************************************************************************\
-* $Id: cdlua5ctx.c,v 1.1 2008/10/17 06:10:42 scuri Exp $
+* $Id: cdlua5ctx.c,v 1.2 2009/12/02 20:31:02 scuri Exp $
* *
\***************************************************************************/
@@ -23,6 +23,7 @@
#include "cdclipbd.h"
#include "cdmf.h"
#include "cdps.h"
+#include "cdsvg.h"
#include "cddbuf.h"
#include "cdgdiplus.h"
@@ -688,6 +689,24 @@ static cdluaContext cdluapsctx =
};
/***************************************************************************\
+* CD_SVG. *
+\***************************************************************************/
+static void *cdsvg_checkdata( lua_State *L, int param)
+{
+ return (void *)luaL_checkstring(L, param);
+}
+
+static cdluaContext cdluasvgctx =
+{
+ 0,
+ "SVG",
+ cdContextSVG,
+ cdsvg_checkdata,
+ NULL,
+ 0
+};
+
+/***************************************************************************\
* CD_PRINTER. *
\***************************************************************************/
static void *cdprinter_checkdata(lua_State *L, int param)
@@ -793,6 +812,7 @@ void cdlua_initdrivers(lua_State * L, cdluaLuaState* cdL)
cdlua_addcontext(L, cdL, &cdluacgmctx);
cdlua_addcontext(L, cdL, &cdluamfctx);
cdlua_addcontext(L, cdL, &cdluapsctx);
+ cdlua_addcontext(L, cdL, &cdluasvgctx);
cdlua_addcontext(L, cdL, &cdluaclipboardctx);
cdlua_addcontext(L, cdL, &cdluanativewindowctx);
cdlua_addcontext(L, cdL, &cdluaprinterctx);