From 64a0b5ebb41d36a7db87d24c5451f7db925e24f8 Mon Sep 17 00:00:00 2001
From: scuri
Date: Fri, 18 Mar 2011 22:23:38 +0000
Subject: New: functions cdContextIsPlus and cdContextType.
---
html/en/drv/cairo.html | 2 +-
html/en/func/init.html | 25 ++-
html/en/history.html | 6 +-
html/wb/wb_usr.lua | 8 +
html/wb_tree.html | 356 ++++++++++++++++++++--------------------
include/cd.h | 12 +-
include/cd_private.h | 5 +-
mak.vc9/cdcairo.vcproj | 2 +-
src/cairo/cdcairodbuf.c | 3 +-
src/cairo/cdcairoemf.c | 3 +-
src/cairo/cdcairoimg.c | 3 +-
src/cairo/cdcairoirgb.c | 3 +-
src/cairo/cdcaironative_gdk.c | 1 +
src/cairo/cdcaironative_win32.c | 3 +-
src/cairo/cdcaironative_x11.c | 1 +
src/cairo/cdcairopdf.c | 3 +-
src/cairo/cdcairoplus.c | 10 +-
src/cairo/cdcairoprn_unix.c | 3 +-
src/cairo/cdcairoprn_win32.c | 3 +-
src/cairo/cdcairops.c | 3 +-
src/cairo/cdcairosvg.c | 3 +-
src/cd.c | 14 ++
src/cd.def | 2 +
src/cdgdk.def | 2 +
src/drv/cd0emf.c | 2 +-
src/drv/cd0prn.c | 2 +-
src/drv/cdcgm.c | 1 +
src/drv/cddebug.c | 1 +
src/drv/cddgn.c | 1 +
src/drv/cddxf.c | 1 +
src/drv/cdgl.c | 1 +
src/drv/cdirgb.c | 2 +
src/drv/cdmf.c | 1 +
src/drv/cdpdf.c | 1 +
src/drv/cdpicture.c | 1 +
src/drv/cdps.c | 1 +
src/gdiplus/cdwclpp.cpp | 1 +
src/gdiplus/cdwdbufp.cpp | 1 +
src/gdiplus/cdwemfp.cpp | 1 +
src/gdiplus/cdwgdiplus.c | 12 +-
src/gdiplus/cdwimgp.cpp | 1 +
src/gdiplus/cdwnativep.cpp | 1 +
src/gdiplus/cdwprnp.cpp | 1 +
src/gdk/cdgdkclp.c | 1 +
src/gdk/cdgdkdbuf.c | 3 +-
src/gdk/cdgdkimg.c | 3 +-
src/gdk/cdgdknative.c | 5 +-
src/lua5/cdlua5.c | 87 ++++++----
src/lua5/cdvoid5.c | 1 +
src/svg/cdsvg.c | 1 +
src/win32/cdwclp.c | 3 +-
src/win32/cdwdbuf.c | 3 +-
src/win32/cdwemf.c | 3 +-
src/win32/cdwimg.c | 3 +-
src/win32/cdwnative.c | 3 +-
src/win32/cdwprn.c | 3 +-
src/win32/cdwwmf.c | 1 +
src/x11/cdxclp.c | 1 +
src/x11/cdxdbuf.c | 3 +-
src/x11/cdximg.c | 3 +-
src/x11/cdxnative.c | 5 +-
src/xrender/cdxrender.c | 6 +-
src/xrender/cdxrplus.c | 6 +-
63 files changed, 390 insertions(+), 263 deletions(-)
diff --git a/html/en/drv/cairo.html b/html/en/drv/cairo.html
index 0b28ea5..793760e 100644
--- a/html/en/drv/cairo.html
+++ b/html/en/drv/cairo.html
@@ -67,7 +67,7 @@ driver can be used; in other UNICES only the X-Win base driver
can be used.
Extra Drivers (cdcairo.h)
-Only available in Lua when require"cdluacairo" is
+
These are not ContextPlus drivers. In Lua, they are available only when require"cdluacairo" is
used.
CD_CAIRO_PS - PostScript Driver
diff --git a/html/en/func/init.html b/html/en/func/init.html
index 8b3bccb..a73deea 100644
--- a/html/en/func/init.html
+++ b/html/en/func/init.html
@@ -132,13 +132,13 @@ transparency.
In Lua, when using require"cdluacontextplus" this function will be
automatically called.
-
cdContext* cdCanvasGetContext(cdCanvas *canvas); [in C]
+
cdContext* cdCanvasGetContext(cdCanvas *canvas); [in C]
canvas:GetContext(canvas: cdCanvas) -> (ctx: number) [in Lua]
Returns the context of a given canvas, which can be compared with the predefined contexts, such as "CD_PS".
-
int cdContextCaps(cdContext* ctx); [in C]
+
int cdContextCaps(cdContext* ctx); [in C]
cd.ContextCaps(ctx: number) -> (caps: number) [in Lua]
@@ -181,7 +181,26 @@ cd.ContextCaps(ctx: number) -> (caps: number) [in Lua]
(Native Window and IUP).
-
int cdCanvasSimulate(cdCanvas* canvas, int mode); [in C]
+
int cdContextType(cdContext* ctx); [in C]
+
+cd.ContextType(ctx: number) -> (type: number) [in Lua]
+
+
Returns the type of the context:
+
+
CD_CTX_WINDOW - GUI window based
+CD_CTX_DEVICE - device based (clipboard, printer, picture)
+CD_CTX_IMAGE - server or client image based, including double buffer based
+ CD_CTX_FILE - metafile based
+
+
+
int cdContextIsPlus(cdContext* ctx); [in C]
+
+cd.ContextIsPlus(ctx: number) -> (plus: boolean) [in Lua]
+
+
Returns if it is a context plus.
+
+
+
int cdCanvasSimulate(cdCanvas* canvas, int mode); [in C]
canvas:Simulate(mode: number) -> (old_mode: number) [in Lua]
diff --git a/html/en/history.html b/html/en/history.html
index cdb7187..117262b 100644
--- a/html/en/history.html
+++ b/html/en/history.html
@@ -27,8 +27,10 @@
History of Changes
-
CVS (17/Nov/2010)
+
CVS (18/Mar/2011)
+ - New: functions cdContextIsPlus
+ and cdContextType.
- Fixed: defines in Cairo so it can be
compiled using older Cairo and Pango versions.
@@ -51,7 +53,7 @@
Fixed: CD_QUERY in
cdCanvasNativeFont.
- Fixed: canvas:Transform when nil is used
+ Fixed: canvas:Transform when nil is used
to reset the transformation.
Fixed: cdCanvasClear
diff --git a/html/wb/wb_usr.lua b/html/wb/wb_usr.lua
index 939dde3..625286f 100644
--- a/html/wb/wb_usr.lua
+++ b/html/wb/wb_usr.lua
@@ -197,6 +197,14 @@ wb_usr.tree =
name= {nl= "ContextCaps"},
link= "func/init.html#cdContextCaps"
},
+ {
+ name= {nl= "ContextType"},
+ link= "func/init.html#cdContextType"
+ },
+ {
+ name= {nl= "ContextIsPlus"},
+ link= "func/init.html#cdContextIsPlus"
+ },
{
name= {nl= "Simulate"},
link= "func/init.html#cdSimulate"
diff --git a/html/wb_tree.html b/html/wb_tree.html
index a068f84..2cfb538 100644
--- a/html/wb_tree.html
+++ b/html/wb_tree.html
@@ -273,289 +273,291 @@
GetContext
ContextCaps
- Simulate
+ ContextType
+ ContextIsPlus
+ Simulate
- cdlua_open
- cdlua_close
- cdlua_getcanvas
+ cdlua_open
+ cdlua_close
+ cdlua_getcanvas
Control
Coordinate System
- World Coordinates
+ World Coordinates
General Attributes
- Clipping
+ Clipping
Primitives
Other
- Drivers
+ Drivers
diff --git a/include/cd.h b/include/cd.h
index 556afa1..70c266e 100644
--- a/include/cd.h
+++ b/include/cd.h
@@ -57,6 +57,8 @@ void cdInitContextPlus(void); /* need an external library */
typedef int (*cdCallback)(cdCanvas* canvas, ...);
int cdContextRegisterCallback(cdContext *context, int cb, cdCallback func);
unsigned long cdContextCaps(cdContext *context);
+int cdContextIsPlus(cdContext *context);
+int cdContextType(cdContext *context);
/* control */
int cdCanvasSimulate(cdCanvas* canvas, int mode);
@@ -394,7 +396,7 @@ enum { /* some font sizes */
CD_LARGE = 18
};
-/* Canvas Capabilities */
+/* Context Capabilities */
#define CD_CAP_NONE 0x00000000
#define CD_CAP_FLUSH 0x00000001
#define CD_CAP_CLEAR 0x00000002
@@ -430,6 +432,14 @@ enum { /* some font sizes */
#define CD_CAP_BEZIER 0x80000000
#define CD_CAP_ALL 0xFFFFFFFF
+/* Context Types */
+enum {
+ CD_CTX_WINDOW,
+ CD_CTX_DEVICE,
+ CD_CTX_IMAGE,
+ CD_CTX_FILE
+};
+
/* cdPlay definitions */
#define CD_SIZECB 0 /* size callback */
typedef int(*cdSizeCB)(cdCanvas *canvas, int w, int h, double w_mm, double h_mm);
diff --git a/include/cd_private.h b/include/cd_private.h
index c85ddbf..672d23c 100644
--- a/include/cd_private.h
+++ b/include/cd_private.h
@@ -68,7 +68,8 @@ struct _cdImage
struct _cdContext
{
unsigned long caps; /* canvas capabilities, combination of CD_CAP_* */
- int plus; /* indicates if the canvas is context plus */
+ int plus; /* indicates if the context is a context plus */
+ int type; /* context type WINDOW, DEVICE, IMAGE or FILE */
/* can NOT be NULL */
void (*cxCreateCanvas)(cdCanvas* canvas, void *data);
@@ -262,7 +263,7 @@ void wdSetDefaults(cdCanvas* canvas);
/********************/
void cdInitContextPlusList(cdContext* ctx_list[]);
cdContext* cdGetContextPlus(int ctx);
-enum{CD_CTX_NATIVEWINDOW, CD_CTX_IMAGE, CD_CTX_DBUFFER, CD_CTX_PRINTER, CD_CTX_EMF, CD_CTX_CLIPBOARD};
+enum{CD_CTXPLUS_NATIVEWINDOW, CD_CTXPLUS_IMAGE, CD_CTXPLUS_DBUFFER, CD_CTXPLUS_PRINTER, CD_CTXPLUS_EMF, CD_CTXPLUS_CLIPBOARD};
#define NUM_CONTEXTPLUS 6
/*************/
diff --git a/mak.vc9/cdcairo.vcproj b/mak.vc9/cdcairo.vcproj
index f2afddc..662963f 100644
--- a/mak.vc9/cdcairo.vcproj
+++ b/mak.vc9/cdcairo.vcproj
@@ -41,7 +41,7 @@
caps;
}
+int cdContextIsPlus(cdContext *context)
+{
+ if (!context)
+ return (unsigned long)CD_ERROR;
+ return context->plus;
+}
+
+int cdContextType(cdContext *context)
+{
+ if (!context)
+ return (unsigned long)CD_ERROR;
+ return context->type;
+}
+
int cdCanvasSimulate(cdCanvas* canvas, int mode)
{
int sim_mode;
diff --git a/src/cd.def b/src/cd.def
index 038185a..e4c4097 100644
--- a/src/cd.def
+++ b/src/cd.def
@@ -38,6 +38,8 @@ EXPORTS
cdKillCanvas
cdGetContext
cdContextCaps
+ cdContextIsPlus
+ cdContextType
cdActivate
cdActiveCanvas
cdSimulate
diff --git a/src/cdgdk.def b/src/cdgdk.def
index 6489315..a338ee3 100644
--- a/src/cdgdk.def
+++ b/src/cdgdk.def
@@ -38,6 +38,8 @@ EXPORTS
cdKillCanvas
cdGetContext
cdContextCaps
+ cdContextIsPlus
+ cdContextType
cdActivate
cdActiveCanvas
cdSimulate
diff --git a/src/drv/cd0emf.c b/src/drv/cd0emf.c
index 7e05134..920d7ee 100644
--- a/src/drv/cd0emf.c
+++ b/src/drv/cd0emf.c
@@ -14,7 +14,7 @@ cdContext* cdContextEMF(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_EMF);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_EMF);
if (ctx != NULL)
return ctx;
}
diff --git a/src/drv/cd0prn.c b/src/drv/cd0prn.c
index fa313d8..0293bb4 100644
--- a/src/drv/cd0prn.c
+++ b/src/drv/cd0prn.c
@@ -15,7 +15,7 @@ cdContext* cdContextPrinter(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_PRINTER);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_PRINTER);
if (ctx != NULL)
return ctx;
}
diff --git a/src/drv/cdcgm.c b/src/drv/cdcgm.c
index 28624d0..17a1239 100644
--- a/src/drv/cdcgm.c
+++ b/src/drv/cdcgm.c
@@ -1136,6 +1136,7 @@ static cdContext cdCGMContext =
CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB |
CD_CAP_TEXTORIENTATION | CD_CAP_PATH | CD_CAP_BEZIER),
0,
+ CD_CTX_FILE,
cdcreatecanvas,
cdinittable,
cdplayCGM,
diff --git a/src/drv/cddebug.c b/src/drv/cddebug.c
index bd91209..3550fc6 100644
--- a/src/drv/cddebug.c
+++ b/src/drv/cddebug.c
@@ -821,6 +821,7 @@ static cdContext cdDebugContext =
{
CD_CAP_ALL,
0,
+ CD_CTX_FILE,
cdcreatecanvas,
cdinittable,
NULL,
diff --git a/src/drv/cddgn.c b/src/drv/cddgn.c
index e0c497b..505526a 100644
--- a/src/drv/cddgn.c
+++ b/src/drv/cddgn.c
@@ -1688,6 +1688,7 @@ static cdContext cdDGNContext =
CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB |
CD_CAP_FPRIMTIVES | CD_CAP_TEXTORIENTATION),
0,
+ CD_CTX_FILE,
cdcreatecanvas,
cdinittable,
NULL,
diff --git a/src/drv/cddxf.c b/src/drv/cddxf.c
index c5d0df5..bdb77a4 100644
--- a/src/drv/cddxf.c
+++ b/src/drv/cddxf.c
@@ -1364,6 +1364,7 @@ static cdContext cdDXFContext =
CD_CAP_HATCH | CD_CAP_STIPPLE | CD_CAP_PATTERN |
CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB),
0,
+ CD_CTX_FILE,
cdcreatecanvas,
cdinittable,
NULL,
diff --git a/src/drv/cdgl.c b/src/drv/cdgl.c
index fb1739d..120e4bc 100644
--- a/src/drv/cdgl.c
+++ b/src/drv/cdgl.c
@@ -1548,6 +1548,7 @@ static cdContext cdGLContext =
CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_PALETTE | CD_CAP_LINEJOIN | CD_CAP_LINECAP |
CD_CAP_REGION | CD_CAP_STIPPLE | CD_CAP_PATTERN),
0,
+ CD_CTX_WINDOW,
cdcreatecanvas,
cdinittable,
NULL,
diff --git a/src/drv/cdirgb.c b/src/drv/cdirgb.c
index fa45f97..5b72dc6 100644
--- a/src/drv/cdirgb.c
+++ b/src/drv/cdirgb.c
@@ -1879,6 +1879,7 @@ static cdContext cdImageRGBContext =
CD_CAP_LINECAP | CD_CAP_LINEJOIN |
CD_CAP_PALETTE ),
0,
+ CD_CTX_IMAGE,
cdcreatecanvas,
cdinittable,
NULL,
@@ -1975,6 +1976,7 @@ static cdContext cdDBufferRGBContext =
CD_CAP_LINECAP | CD_CAP_LINEJOIN |
CD_CAP_PALETTE ),
0,
+ CD_CTX_IMAGE,
cdcreatecanvasDB,
cdinittableDB,
NULL,
diff --git a/src/drv/cdmf.c b/src/drv/cdmf.c
index ddb109c..ecbdf8c 100644
--- a/src/drv/cdmf.c
+++ b/src/drv/cdmf.c
@@ -1263,6 +1263,7 @@ static cdContext cdMetafileContext =
CD_CAP_ALL & ~(CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV |
CD_CAP_REGION | CD_CAP_FONTDIM | CD_CAP_TEXTSIZE),
0,
+ CD_CTX_FILE,
cdcreatecanvasMF,
cdinittableMF,
cdplay,
diff --git a/src/drv/cdpdf.c b/src/drv/cdpdf.c
index 3211cba..f7f3b36 100644
--- a/src/drv/cdpdf.c
+++ b/src/drv/cdpdf.c
@@ -1734,6 +1734,7 @@ static cdContext cdPDFContext =
CD_CAP_REGION | CD_CAP_IMAGESRV | CD_CAP_TEXTSIZE |
CD_CAP_WRITEMODE | CD_CAP_GETIMAGERGB),
0,
+ CD_CTX_FILE,
cdcreatecanvas,
cdinittable,
NULL,
diff --git a/src/drv/cdpicture.c b/src/drv/cdpicture.c
index 8cd586e..85bb84a 100644
--- a/src/drv/cdpicture.c
+++ b/src/drv/cdpicture.c
@@ -1397,6 +1397,7 @@ static cdContext cdPictureContext =
CD_CAP_ALL & ~(CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV |
CD_CAP_REGION | CD_CAP_FONTDIM | CD_CAP_TEXTSIZE),
0,
+ CD_CTX_DEVICE,
cdcreatecanvas,
cdinittable,
cdplay,
diff --git a/src/drv/cdps.c b/src/drv/cdps.c
index 0db3590..abd7359 100644
--- a/src/drv/cdps.c
+++ b/src/drv/cdps.c
@@ -2128,6 +2128,7 @@ static cdContext cdPSContext =
CD_CAP_FONTDIM | CD_CAP_TEXTSIZE |
CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB),
0,
+ CD_CTX_FILE,
cdcreatecanvas,
cdinittable,
NULL,
diff --git a/src/gdiplus/cdwclpp.cpp b/src/gdiplus/cdwclpp.cpp
index 2d1c7e6..9fa2c4c 100644
--- a/src/gdiplus/cdwclpp.cpp
+++ b/src/gdiplus/cdwclpp.cpp
@@ -189,6 +189,7 @@ static cdContext cdClipboardContext =
CD_CAP_ALL & ~(CD_CAP_CLEAR | CD_CAP_FLUSH | CD_CAP_YAXIS | CD_CAP_PLAY |
CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV ),
1,
+ CD_CTX_DEVICE,
cdcreatecanvas,
cdinittable,
NULL,
diff --git a/src/gdiplus/cdwdbufp.cpp b/src/gdiplus/cdwdbufp.cpp
index 68bc7b8..df81265 100644
--- a/src/gdiplus/cdwdbufp.cpp
+++ b/src/gdiplus/cdwdbufp.cpp
@@ -149,6 +149,7 @@ static cdContext cdDBufferContext =
{
CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS ),
1,
+ CD_CTX_IMAGE,
cdcreatecanvas,
cdinittable,
NULL,
diff --git a/src/gdiplus/cdwemfp.cpp b/src/gdiplus/cdwemfp.cpp
index 23ae02d..b19f4cb 100644
--- a/src/gdiplus/cdwemfp.cpp
+++ b/src/gdiplus/cdwemfp.cpp
@@ -88,6 +88,7 @@ static cdContext cdEMFContext =
CD_CAP_ALL & ~(CD_CAP_CLEAR | CD_CAP_PLAY | CD_CAP_FLUSH | CD_CAP_YAXIS |
CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV),
1,
+ CD_CTX_FILE,
cdcreatecanvas,
cdinittable,
NULL,
diff --git a/src/gdiplus/cdwgdiplus.c b/src/gdiplus/cdwgdiplus.c
index a6862bc..4997d3c 100644
--- a/src/gdiplus/cdwgdiplus.c
+++ b/src/gdiplus/cdwgdiplus.c
@@ -28,12 +28,12 @@ void cdInitContextPlus(void)
cdContext* ctx_list[NUM_CONTEXTPLUS];
memset(ctx_list, 0, sizeof(ctx_list));
- ctx_list[CD_CTX_NATIVEWINDOW] = cdContextNativeWindowPlus();
- ctx_list[CD_CTX_IMAGE] = cdContextImagePlus();
- ctx_list[CD_CTX_DBUFFER] = cdContextDBufferPlus();
- ctx_list[CD_CTX_PRINTER] = cdContextPrinterPlus();
- ctx_list[CD_CTX_EMF] = cdContextEMFPlus();
- ctx_list[CD_CTX_CLIPBOARD] = cdContextClipboardPlus();
+ ctx_list[CD_CTXPLUS_NATIVEWINDOW] = cdContextNativeWindowPlus();
+ ctx_list[CD_CTXPLUS_IMAGE] = cdContextImagePlus();
+ ctx_list[CD_CTXPLUS_DBUFFER] = cdContextDBufferPlus();
+ ctx_list[CD_CTXPLUS_PRINTER] = cdContextPrinterPlus();
+ ctx_list[CD_CTXPLUS_EMF] = cdContextEMFPlus();
+ ctx_list[CD_CTXPLUS_CLIPBOARD] = cdContextClipboardPlus();
cdInitContextPlusList(ctx_list);
diff --git a/src/gdiplus/cdwimgp.cpp b/src/gdiplus/cdwimgp.cpp
index 5dd8b96..9b45edb 100644
--- a/src/gdiplus/cdwimgp.cpp
+++ b/src/gdiplus/cdwimgp.cpp
@@ -50,6 +50,7 @@ static cdContext cdImageContext =
{
CD_CAP_ALL & ~(CD_CAP_FLUSH | CD_CAP_PLAY | CD_CAP_YAXIS ),
1,
+ CD_CTX_IMAGE,
cdcreatecanvas,
cdinittable,
NULL,
diff --git a/src/gdiplus/cdwnativep.cpp b/src/gdiplus/cdwnativep.cpp
index 80209af..4fdc19a 100644
--- a/src/gdiplus/cdwnativep.cpp
+++ b/src/gdiplus/cdwnativep.cpp
@@ -123,6 +123,7 @@ static cdContext cdNativeContext =
{
CD_CAP_ALL & ~(CD_CAP_FLUSH | CD_CAP_PLAY | CD_CAP_YAXIS ),
1,
+ CD_CTX_WINDOW,
cdcreatecanvas,
cdinittable,
NULL,
diff --git a/src/gdiplus/cdwprnp.cpp b/src/gdiplus/cdwprnp.cpp
index 2eed9d9..df62ca5 100644
--- a/src/gdiplus/cdwprnp.cpp
+++ b/src/gdiplus/cdwprnp.cpp
@@ -142,6 +142,7 @@ static cdContext cdPrinterContext =
CD_CAP_ALL & ~(CD_CAP_CLEAR | CD_CAP_PLAY | CD_CAP_YAXIS |
CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV),
1,
+ CD_CTX_DEVICE,
cdcreatecanvas,
cdinittable,
NULL,
diff --git a/src/gdk/cdgdkclp.c b/src/gdk/cdgdkclp.c
index c6557b9..e861b5e 100644
--- a/src/gdk/cdgdkclp.c
+++ b/src/gdk/cdgdkclp.c
@@ -122,6 +122,7 @@ static cdContext cdClipboardContext =
{
CD_CAP_ALL & ~(CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV | CD_CAP_FONTDIM | CD_CAP_TEXTSIZE ), /* same as CD_MF */
0,
+ CD_CTX_DEVICE,
cdcreatecanvas,
cdinittable,
cdplay,
diff --git a/src/gdk/cdgdkdbuf.c b/src/gdk/cdgdkdbuf.c
index 50a93a5..3df8ec3 100644
--- a/src/gdk/cdgdkdbuf.c
+++ b/src/gdk/cdgdkdbuf.c
@@ -129,6 +129,7 @@ static cdContext cdDBufferContext =
{
CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_PATH | CD_CAP_BEZIER | CD_CAP_FPRIMTIVES ),
0,
+ CD_CTX_IMAGE,
cdcreatecanvas,
cdinittable,
NULL,
@@ -139,7 +140,7 @@ cdContext* cdContextDBuffer(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_DBUFFER);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_DBUFFER);
if (ctx != NULL)
return ctx;
}
diff --git a/src/gdk/cdgdkimg.c b/src/gdk/cdgdkimg.c
index 4b4475b..aab9a1b 100644
--- a/src/gdk/cdgdkimg.c
+++ b/src/gdk/cdgdkimg.c
@@ -32,6 +32,7 @@ static cdContext cdImageContext =
{
CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES | CD_CAP_PATH | CD_CAP_BEZIER ),
0,
+ CD_CTX_IMAGE,
cdcreatecanvas,
cdinittable,
NULL,
@@ -43,7 +44,7 @@ cdContext* cdContextImage(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_IMAGE);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_IMAGE);
if (ctx != NULL)
return ctx;
}
diff --git a/src/gdk/cdgdknative.c b/src/gdk/cdgdknative.c
index 8865d7e..8e66dbe 100644
--- a/src/gdk/cdgdknative.c
+++ b/src/gdk/cdgdknative.c
@@ -96,7 +96,8 @@ static void cdinittable(cdCanvas* canvas)
static cdContext cdNativeWindowContext =
{
CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES | CD_CAP_PATH | CD_CAP_BEZIER ),
- 1,
+ 0,
+ CD_CTX_WINDOW,
cdcreatecanvas,
cdinittable,
NULL,
@@ -108,7 +109,7 @@ cdContext* cdContextNativeWindow(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_NATIVEWINDOW);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_NATIVEWINDOW);
if (ctx != NULL)
return ctx;
}
diff --git a/src/lua5/cdlua5.c b/src/lua5/cdlua5.c
index 024ed6b..6eb1769 100644
--- a/src/lua5/cdlua5.c
+++ b/src/lua5/cdlua5.c
@@ -335,7 +335,21 @@ void cdlua_pushbitmap(lua_State* L, cdBitmap* bitmap)
static int cdlua5_contextcaps(lua_State * L)
{
cdluaContext* cdlua_ctx = cdlua_getcontext(L, 1);
- lua_pushnumber(L, cdContextCaps(cdlua_ctx->ctx()));
+ lua_pushinteger(L, cdContextCaps(cdlua_ctx->ctx()));
+ return 1;
+}
+
+static int cdlua5_contexttype(lua_State * L)
+{
+ cdluaContext* cdlua_ctx = cdlua_getcontext(L, 1);
+ lua_pushinteger(L, cdContextType(cdlua_ctx->ctx()));
+ return 1;
+}
+
+static int cdlua5_contextisplus(lua_State * L)
+{
+ cdluaContext* cdlua_ctx = cdlua_getcontext(L, 1);
+ lua_pushboolean(L, cdContextIsPlus(cdlua_ctx->ctx()));
return 1;
}
@@ -1315,6 +1329,8 @@ static const struct luaL_reg cdlib[] = {
/* Initialization */
{"ContextCaps" , cdlua5_contextcaps},
+ {"ContextType" , cdlua5_contexttype},
+ {"ContextIsPlus" , cdlua5_contextisplus},
/* Control */
{"ReleaseState" , cdlua5_releasestate},
@@ -1553,38 +1569,45 @@ static const struct cdlua5_constant cdlibconstant[] = {
{"LARGE" , CD_LARGE},
/* Canvas Capabilities */
- {"CAP_NONE" , CD_CAP_NONE},
- {"CAP_FLUSH" , CD_CAP_FLUSH},
- {"CAP_CLEAR" , CD_CAP_CLEAR},
- {"CAP_PLAY" , CD_CAP_PLAY},
- {"CAP_YAXIS" , CD_CAP_YAXIS},
- {"CAP_CLIPAREA" , CD_CAP_CLIPAREA},
- {"CAP_CLIPPOLY" , CD_CAP_CLIPPOLY},
- {"CAP_RECT" , CD_CAP_RECT},
- {"CAP_IMAGERGB" , CD_CAP_IMAGERGB},
- {"CAP_IMAGERGBA" , CD_CAP_IMAGERGBA},
- {"CAP_IMAGEMAP" , CD_CAP_IMAGEMAP},
- {"CAP_GETIMAGERGB" , CD_CAP_GETIMAGERGB},
- {"CAP_IMAGESRV" , CD_CAP_IMAGESRV},
- {"CAP_BACKGROUND" , CD_CAP_BACKGROUND},
- {"CAP_BACKOPACITY" , CD_CAP_BACKOPACITY},
- {"CAP_WRITEMODE" , CD_CAP_WRITEMODE},
- {"CAP_LINESTYLE" , CD_CAP_LINESTYLE},
- {"CAP_LINEWITH" , CD_CAP_LINEWITH},
- {"CAP_WD" , CD_CAP_FPRIMTIVES},
- {"CAP_HATCH" , CD_CAP_HATCH},
- {"CAP_STIPPLE" , CD_CAP_STIPPLE},
- {"CAP_PATTERN" , CD_CAP_PATTERN},
- {"CAP_FONT" , CD_CAP_FONT},
- {"CAP_FONTDIM" , CD_CAP_FONTDIM},
- {"CAP_TEXTSIZE" , CD_CAP_TEXTSIZE},
- {"CAP_TEXTORIENTATION", CD_CAP_TEXTORIENTATION},
- {"CAP_PALETTE" , CD_CAP_PALETTE},
- {"CAP_LINECAP" , CD_CAP_LINECAP},
- {"CAP_LINEJOIN" , CD_CAP_LINEJOIN},
- {"CAP_REGION" , CD_CAP_REGION},
+ {"CAP_NONE" , CD_CAP_NONE},
+ {"CAP_FLUSH" , CD_CAP_FLUSH},
+ {"CAP_CLEAR" , CD_CAP_CLEAR},
+ {"CAP_PLAY" , CD_CAP_PLAY},
+ {"CAP_YAXIS" , CD_CAP_YAXIS},
+ {"CAP_CLIPAREA" , CD_CAP_CLIPAREA},
+ {"CAP_CLIPPOLY" , CD_CAP_CLIPPOLY},
+ {"CAP_REGION" , CD_CAP_REGION},
+ {"CAP_RECT" , CD_CAP_RECT},
{"CAP_CHORD" , CD_CAP_CHORD},
- {"CAP_ALL" , CD_CAP_ALL},
+ {"CAP_IMAGERGB" , CD_CAP_IMAGERGB},
+ {"CAP_IMAGERGBA" , CD_CAP_IMAGERGBA},
+ {"CAP_IMAGEMAP" , CD_CAP_IMAGEMAP},
+ {"CAP_GETIMAGERGB" , CD_CAP_GETIMAGERGB},
+ {"CAP_IMAGESRV" , CD_CAP_IMAGESRV},
+ {"CAP_BACKGROUND" , CD_CAP_BACKGROUND},
+ {"CAP_BACKOPACITY" , CD_CAP_BACKOPACITY},
+ {"CAP_WRITEMODE" , CD_CAP_WRITEMODE},
+ {"CAP_LINESTYLE" , CD_CAP_LINESTYLE},
+ {"CAP_LINEWITH" , CD_CAP_LINEWITH},
+ {"CAP_WD" , CD_CAP_FPRIMTIVES},
+ {"CAP_HATCH" , CD_CAP_HATCH},
+ {"CAP_STIPPLE" , CD_CAP_STIPPLE},
+ {"CAP_PATTERN" , CD_CAP_PATTERN},
+ {"CAP_FONT" , CD_CAP_FONT},
+ {"CAP_FONTDIM" , CD_CAP_FONTDIM},
+ {"CAP_TEXTSIZE" , CD_CAP_TEXTSIZE},
+ {"CAP_TEXTORIENTATION", CD_CAP_TEXTORIENTATION},
+ {"CAP_PALETTE" , CD_CAP_PALETTE},
+ {"CAP_LINECAP" , CD_CAP_LINECAP},
+ {"CAP_LINEJOIN" , CD_CAP_LINEJOIN},
+ {"CAP_PATH" , CD_CAP_PATH},
+ {"CAP_BEZIER" , CD_CAP_BEZIER},
+ {"CAP_ALL" , CD_CAP_ALL},
+
+ {"CTX_WINDOW" , CD_CTX_WINDOW},
+ {"CTX_DEVICE" , CD_CTX_DEVICE},
+ {"CTX_IMAGE" , CD_CTX_IMAGE},
+ {"CTX_FILE" , CD_CTX_FILE},
/* cdPlay definitions */
{"SIZECB", CD_SIZECB},
diff --git a/src/lua5/cdvoid5.c b/src/lua5/cdvoid5.c
index 67c2c99..ebc965c 100644
--- a/src/lua5/cdvoid5.c
+++ b/src/lua5/cdvoid5.c
@@ -115,6 +115,7 @@ void cdinittable(cdCanvas* canvas)
static cdContext cdVoidContext =
{
+ 0,
0,
0,
cdcreatecanvas,
diff --git a/src/svg/cdsvg.c b/src/svg/cdsvg.c
index bfde533..64d6be7 100644
--- a/src/svg/cdsvg.c
+++ b/src/svg/cdsvg.c
@@ -1343,6 +1343,7 @@ static cdContext cdSVGContext =
CD_CAP_FONTDIM | CD_CAP_TEXTSIZE |
CD_CAP_GETIMAGERGB),
0,
+ CD_CTX_FILE,
cdcreatecanvas,
cdinittable,
NULL,
diff --git a/src/win32/cdwclp.c b/src/win32/cdwclp.c
index 60c29e0..3c31569 100644
--- a/src/win32/cdwclp.c
+++ b/src/win32/cdwclp.c
@@ -531,6 +531,7 @@ static cdContext cdClipboardContext =
CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV |
CD_CAP_FPRIMTIVES ),
0,
+ CD_CTX_DEVICE,
cdcreatecanvas,
cdinittable,
cdplay,
@@ -541,7 +542,7 @@ cdContext* cdContextClipboard(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_CLIPBOARD);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_CLIPBOARD);
if (ctx != NULL)
return ctx;
}
diff --git a/src/win32/cdwdbuf.c b/src/win32/cdwdbuf.c
index 9d79e9b..54dbf16 100644
--- a/src/win32/cdwdbuf.c
+++ b/src/win32/cdwdbuf.c
@@ -142,6 +142,7 @@ static cdContext cdDBufferContext =
CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS |
CD_CAP_FPRIMTIVES ),
0,
+ CD_CTX_IMAGE,
cdcreatecanvas,
cdinittable,
NULL,
@@ -152,7 +153,7 @@ cdContext* cdContextDBuffer(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_DBUFFER);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_DBUFFER);
if (ctx != NULL)
return ctx;
}
diff --git a/src/win32/cdwemf.c b/src/win32/cdwemf.c
index ad037c9..3932c36 100644
--- a/src/win32/cdwemf.c
+++ b/src/win32/cdwemf.c
@@ -98,6 +98,7 @@ static cdContext cdEMFContext =
CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV |
CD_CAP_FPRIMTIVES ),
0,
+ CD_CTX_FILE,
cdcreatecanvas,
cdinittable,
cdplayEMF,
@@ -108,7 +109,7 @@ cdContext* cdContextEMF(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_EMF);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_EMF);
if (ctx != NULL)
return ctx;
}
diff --git a/src/win32/cdwimg.c b/src/win32/cdwimg.c
index 47d99f9..294a8d7 100644
--- a/src/win32/cdwimg.c
+++ b/src/win32/cdwimg.c
@@ -64,6 +64,7 @@ static cdContext cdImageContext =
CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS |
CD_CAP_FPRIMTIVES ),
0,
+ CD_CTX_IMAGE,
cdcreatecanvas,
cdinittable,
NULL,
@@ -74,7 +75,7 @@ cdContext* cdContextImage(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_IMAGE);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_IMAGE);
if (ctx != NULL)
return ctx;
}
diff --git a/src/win32/cdwnative.c b/src/win32/cdwnative.c
index 3534c6e..bd9d4dd 100644
--- a/src/win32/cdwnative.c
+++ b/src/win32/cdwnative.c
@@ -186,6 +186,7 @@ static cdContext cdNativeContext =
{
CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES ),
0,
+ CD_CTX_WINDOW,
cdcreatecanvas,
cdinittable,
NULL,
@@ -196,7 +197,7 @@ cdContext* cdContextNativeWindow(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_NATIVEWINDOW);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_NATIVEWINDOW);
if (ctx != NULL)
return ctx;
}
diff --git a/src/win32/cdwprn.c b/src/win32/cdwprn.c
index 1b3e1e0..1ffcd03 100644
--- a/src/win32/cdwprn.c
+++ b/src/win32/cdwprn.c
@@ -186,6 +186,7 @@ static cdContext cdPrinterContext =
CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV |
CD_CAP_FPRIMTIVES ),
0,
+ CD_CTX_DEVICE,
cdcreatecanvas,
cdinittable,
NULL,
@@ -196,7 +197,7 @@ cdContext* cdContextPrinter(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_PRINTER);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_PRINTER);
if (ctx != NULL)
return ctx;
}
diff --git a/src/win32/cdwwmf.c b/src/win32/cdwwmf.c
index 0571c9f..26d8fa9 100644
--- a/src/win32/cdwwmf.c
+++ b/src/win32/cdwwmf.c
@@ -97,6 +97,7 @@ static cdContext cdWMFContext =
CD_CAP_LINECAP | CD_CAP_LINEJOIN |
CD_CAP_FPRIMTIVES ),
0,
+ CD_CTX_FILE,
cdcreatecanvas,
cdinittable,
cdplayWMF,
diff --git a/src/x11/cdxclp.c b/src/x11/cdxclp.c
index 9363491..ed3b0db 100644
--- a/src/x11/cdxclp.c
+++ b/src/x11/cdxclp.c
@@ -125,6 +125,7 @@ static cdContext cdClipboardContext =
{
CD_CAP_ALL & ~(CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV | CD_CAP_FONTDIM | CD_CAP_TEXTSIZE ), /* same as CD_MF */
0,
+ CD_CTX_DEVICE,
cdcreatecanvas,
cdinittable,
cdplay,
diff --git a/src/x11/cdxdbuf.c b/src/x11/cdxdbuf.c
index 29d1e4e..7d29467 100644
--- a/src/x11/cdxdbuf.c
+++ b/src/x11/cdxdbuf.c
@@ -128,6 +128,7 @@ static cdContext cdDBufferContext =
{
CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES | CD_CAP_PATH | CD_CAP_BEZIER ),
0,
+ CD_CTX_IMAGE,
cdcreatecanvas,
cdinittable,
NULL,
@@ -138,7 +139,7 @@ cdContext* cdContextDBuffer(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_DBUFFER);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_DBUFFER);
if (ctx != NULL)
return ctx;
}
diff --git a/src/x11/cdximg.c b/src/x11/cdximg.c
index c823705..12db352 100644
--- a/src/x11/cdximg.c
+++ b/src/x11/cdximg.c
@@ -32,6 +32,7 @@ static cdContext cdImageContext =
{
CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES | CD_CAP_PATH | CD_CAP_BEZIER ),
0,
+ CD_CTX_IMAGE,
cdcreatecanvas,
cdinittable,
NULL,
@@ -43,7 +44,7 @@ cdContext* cdContextImage(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_IMAGE);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_IMAGE);
if (ctx != NULL)
return ctx;
}
diff --git a/src/x11/cdxnative.c b/src/x11/cdxnative.c
index a69314c..ddf6670 100644
--- a/src/x11/cdxnative.c
+++ b/src/x11/cdxnative.c
@@ -144,7 +144,8 @@ static void cdinittable(cdCanvas* canvas)
static cdContext cdNativeWindowContext =
{
CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES | CD_CAP_PATH | CD_CAP_BEZIER),
- 1,
+ 0,
+ CD_CTX_WINDOW,
cdcreatecanvas,
cdinittable,
NULL,
@@ -156,7 +157,7 @@ cdContext* cdContextNativeWindow(void)
{
if (cdUseContextPlus(CD_QUERY))
{
- cdContext* ctx = cdGetContextPlus(CD_CTX_NATIVEWINDOW);
+ cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_NATIVEWINDOW);
if (ctx != NULL)
return ctx;
}
diff --git a/src/xrender/cdxrender.c b/src/xrender/cdxrender.c
index 2f99da3..dfd4370 100644
--- a/src/xrender/cdxrender.c
+++ b/src/xrender/cdxrender.c
@@ -981,9 +981,9 @@ static void xrCreateContextPlus(cdCtxCanvas *ctxcanvas)
/*******************************************************************************************************/
-static cdContext cdDBufferContext = {0,0,NULL,NULL,NULL,NULL};
-static cdContext cdNativeWindowContext = {0,0,NULL,NULL,NULL,NULL};
-static cdContext cdImageContext = {0,0,NULL,NULL,NULL,NULL};
+static cdContext cdDBufferContext = {0,0,0,NULL,NULL,NULL,NULL};
+static cdContext cdNativeWindowContext = {0,0,0,NULL,NULL,NULL,NULL};
+static cdContext cdImageContext = {0,0,0,NULL,NULL,NULL,NULL};
static void (*cdcreatecanvasDBUFFER)(cdCanvas* canvas, void* data) = NULL;
static void (*cdcreatecanvasNATIVE)(cdCanvas* canvas, void* data) = NULL;
diff --git a/src/xrender/cdxrplus.c b/src/xrender/cdxrplus.c
index f938a6f..589aa3c 100644
--- a/src/xrender/cdxrplus.c
+++ b/src/xrender/cdxrplus.c
@@ -18,9 +18,9 @@ void cdInitContextPlus(void)
cdContext* ctx_list[NUM_CONTEXTPLUS];
memset(ctx_list, 0, sizeof(ctx_list));
- ctx_list[CD_CTX_NATIVEWINDOW] = cdContextNativeWindowPlus();
- ctx_list[CD_CTX_IMAGE] = cdContextImagePlus();
- ctx_list[CD_CTX_DBUFFER] = cdContextDBufferPlus();
+ ctx_list[CD_CTXPLUS_NATIVEWINDOW] = cdContextNativeWindowPlus();
+ ctx_list[CD_CTXPLUS_IMAGE] = cdContextImagePlus();
+ ctx_list[CD_CTXPLUS_DBUFFER] = cdContextDBufferPlus();
cdInitContextPlusList(ctx_list);
}
--
cgit v1.2.3