diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cairo/cdcairo.def | 1 | ||||
-rw-r--r-- | src/cd.def | 1 | ||||
-rw-r--r-- | src/cdcairo.mak | 6 | ||||
-rw-r--r-- | src/lua5/cdlua5_canvas.c | 38 |
4 files changed, 22 insertions, 24 deletions
diff --git a/src/cairo/cdcairo.def b/src/cairo/cdcairo.def index 874e2af..ad4dbeb 100644 --- a/src/cairo/cdcairo.def +++ b/src/cairo/cdcairo.def @@ -2,7 +2,6 @@ EXPORTS cdContextCairoImage cdContextCairoImageRGB cdContextCairoPS - cdContextCairoPrinter cdContextCairoNativeWindow cdContextCairoDBuffer cdContextCairoSVG @@ -394,6 +394,7 @@ EXPORTS cdCanvasSetBackground cdCanvasTransformPoint cdfCanvasTransformPoint + cdRound cdInitContextPlusList cdGetContextPlus diff --git a/src/cdcairo.mak b/src/cdcairo.mak index 07d3190..6dbce6a 100644 --- a/src/cdcairo.mak +++ b/src/cdcairo.mak @@ -4,8 +4,6 @@ OPT = YES DEFINES = CD_NO_OLD_INTERFACE -USE_CAIRO = Yes - INCLUDES = . cairo drv SRCDIR = cairo SRC = cdcairodbuf.c cdcairopdf.c cdcairosvg.c cdcairo.c cdcairoimg.c cdcairoplus.c cdcairoirgb.c cdcairops.c @@ -20,7 +18,9 @@ else endif INCLUDES += $(GTK)/include/cairo $(GTK)/include/pango-1.0 $(GTK)/include/glib-2.0 $(GTK)/lib/glib-2.0/include -LDIR += $(GTK)/lib +LDIR = $(GTK)/lib +LIBS = pangocairo-1.0 cairo pango-1.0 gobject-2.0 glib-2.0 +# Can NOT use USE_CAIRO because cdcairo.lib will be included for linking USE_CD = YES CD = .. diff --git a/src/lua5/cdlua5_canvas.c b/src/lua5/cdlua5_canvas.c index 37d36b3..c2f6008 100644 --- a/src/lua5/cdlua5_canvas.c +++ b/src/lua5/cdlua5_canvas.c @@ -1494,7 +1494,7 @@ static int wdlua5_gettextbox(lua_State *L) } /***************************************************************************************************************\ -* cd.GetTextBounds(x, y: number, text: string) -> (rect0, rect1, rect2, rect3, rect4, rect5, rect6, rect7: number) * +* cd.GetTextBounds(x, y: number, text: string) -> (rect: table) * \***************************************************************************************************************/ static int cdlua5_gettextbounds(lua_State *L) { @@ -1502,21 +1502,20 @@ static int cdlua5_gettextbounds(lua_State *L) int x = luaL_checkint(L, 2); int y = luaL_checkint(L, 3); const char* s = luaL_checkstring(L, 4); + int i; cdCanvasGetTextBounds(cdlua_checkcanvas(L, 1), x, y, s, rect); - lua_pushnumber(L, rect[0]); - lua_pushnumber(L, rect[1]); - lua_pushnumber(L, rect[2]); - lua_pushnumber(L, rect[3]); - lua_pushnumber(L, rect[4]); - lua_pushnumber(L, rect[5]); - lua_pushnumber(L, rect[6]); - lua_pushnumber(L, rect[7]); - return 4; + lua_newtable(L); + for (i=0; i < 8; i++) + { + lua_pushnumber(L, rect[i]); + lua_rawseti(L, -2, i+1); + } + return 1; } /****************************************************************************************************************\ -* cd.wGetTextBounds(x, y: number, text: string) -> (rect0, rect1, rect2, rect3, rect4, rect5, rect6, rect7: number) * +* cd.wGetTextBounds(x, y: number, text: string) -> (rect: table) * \****************************************************************************************************************/ static int wdlua5_gettextbounds(lua_State *L) { @@ -1524,17 +1523,16 @@ static int wdlua5_gettextbounds(lua_State *L) double x = luaL_checknumber(L, 2); double y = luaL_checknumber(L, 3); const char* s = luaL_checkstring(L, 4); + int i; wdCanvasGetTextBounds(cdlua_checkcanvas(L, 1), x, y, s, rect); - lua_pushnumber(L, rect[0]); - lua_pushnumber(L, rect[1]); - lua_pushnumber(L, rect[2]); - lua_pushnumber(L, rect[3]); - lua_pushnumber(L, rect[4]); - lua_pushnumber(L, rect[5]); - lua_pushnumber(L, rect[6]); - lua_pushnumber(L, rect[7]); - return 4; + lua_newtable(L); + for (i=0; i < 8; i++) + { + lua_pushnumber(L, rect[i]); + lua_rawseti(L, -2, i+1); + } + return 1; } |