summaryrefslogtreecommitdiff
path: root/cd/include
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2010-09-09 01:48:52 +0200
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2010-09-09 01:50:25 +0200
commite9a184546b18cf3b796bd560561f312934004c54 (patch)
treeaa785af9a8d03f8ce276c9e9ecec78397005ec22 /cd/include
parent92efe73791d0998536042bfab5a1babc67d168c7 (diff)
Upgrading to CD 5.4 - and cleaning up.
Diffstat (limited to 'cd/include')
-rwxr-xr-xcd/include/cd.h56
-rwxr-xr-xcd/include/cd_private.h24
-rw-r--r--cd/include/cdcairo.h45
-rw-r--r--cd/include/cdgl.h23
-rwxr-xr-xcd/include/cdlua.h1
-rwxr-xr-xcd/include/cdlua5_private.h3
-rw-r--r--cd/include/cdluagl.h27
-rwxr-xr-xcd/include/cdpdf.h15
-rwxr-xr-xcd/include/cdps.h14
9 files changed, 164 insertions, 44 deletions
diff --git a/cd/include/cd.h b/cd/include/cd.h
index ca38983..85b02c2 100755
--- a/cd/include/cd.h
+++ b/cd/include/cd.h
@@ -19,9 +19,9 @@ extern "C" {
#define CD_NAME "CD - Canvas Draw"
#define CD_DESCRIPTION "A 2D Graphics Library"
#define CD_COPYRIGHT "Copyright (C) 1994-2010 Tecgraf, PUC-Rio."
-#define CD_VERSION "5.3" /* bug fixes are reported only by cdVersion functions */
-#define CD_VERSION_NUMBER 503000
-#define CD_VERSION_DATE "2010/01/26"
+#define CD_VERSION "5.4" /* bug fixes are reported only by cdVersion functions */
+#define CD_VERSION_NUMBER 504000
+#define CD_VERSION_DATE "2010/06/24" /* does not include bug fix releases */
typedef struct _cdContext cdContext;
typedef struct _cdCanvas cdCanvas;
@@ -113,10 +113,12 @@ int cdCanvasRegionCombineMode(cdCanvas* canvas, int mode);
void cdCanvasPixel(cdCanvas* canvas, int x, int y, long color);
void cdCanvasMark(cdCanvas* canvas, int x, int y);
-void cdCanvasLine(cdCanvas* canvas, int x1, int y1, int x2, int y2);
void cdCanvasBegin(cdCanvas* canvas, int mode);
-void cdCanvasVertex(cdCanvas* canvas, int x, int y);
+void cdCanvasPathSet(cdCanvas* canvas, int action);
void cdCanvasEnd(cdCanvas* canvas);
+
+void cdCanvasLine(cdCanvas* canvas, int x1, int y1, int x2, int y2);
+void cdCanvasVertex(cdCanvas* canvas, int x, int y);
void cdCanvasRect(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
void cdCanvasBox(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
void cdCanvasArc(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
@@ -152,7 +154,7 @@ unsigned char* cdCanvasGetStipple(cdCanvas* canvas, int *n, int *m);
void cdCanvasPattern(cdCanvas* canvas, int w, int h, long const int *pattern);
long* cdCanvasGetPattern(cdCanvas* canvas, int* n, int* m);
int cdCanvasFillMode(cdCanvas* canvas, int mode);
-int cdCanvasFont(cdCanvas* canvas, const char* type_face, int style, int size);
+int cdCanvasFont(cdCanvas* canvas, const char* type_face, int style, int size);
void cdCanvasGetFont(cdCanvas* canvas, char *type_face, int *style, int *size);
char* cdCanvasNativeFont(cdCanvas* canvas, const char* font);
int cdCanvasTextAlignment(cdCanvas* canvas, int alignment);
@@ -165,13 +167,13 @@ void cdCanvasVectorText(cdCanvas* canvas, int x, int y, const char* s);
void cdCanvasMultiLineVectorText(cdCanvas* canvas, int x, int y, const char* s);
/* vector text attributes */
-char *cdCanvasVectorFont(cdCanvas* canvas, const char *filename);
-void cdCanvasVectorTextDirection(cdCanvas* canvas, int x1, int y1, int x2, int y2);
+char* cdCanvasVectorFont(cdCanvas* canvas, const char *filename);
+void cdCanvasVectorTextDirection(cdCanvas* canvas, int x1, int y1, int x2, int y2);
double* cdCanvasVectorTextTransform(cdCanvas* canvas, const double* matrix);
-void cdCanvasVectorTextSize(cdCanvas* canvas, int size_x, int size_y, const char* s);
-int cdCanvasVectorCharSize(cdCanvas* canvas, int size);
-void cdCanvasVectorFontSize(cdCanvas* canvas, double size_x, double size_y);
-void cdCanvasGetVectorFontSize(cdCanvas* canvas, double *size_x, double *size_y);
+void cdCanvasVectorTextSize(cdCanvas* canvas, int size_x, int size_y, const char* s);
+int cdCanvasVectorCharSize(cdCanvas* canvas, int size);
+void cdCanvasVectorFontSize(cdCanvas* canvas, double size_x, double size_y);
+void cdCanvasGetVectorFontSize(cdCanvas* canvas, double *size_x, double *size_y);
/* vector text properties */
void cdCanvasGetVectorTextSize(cdCanvas* canvas, const char* s, int *x, int *y);
@@ -271,11 +273,25 @@ enum { /* polygon mode (begin...end) */
CD_CLOSED_LINES,
CD_CLIP,
CD_BEZIER,
- CD_REGION
+ CD_REGION,
+ CD_PATH
};
#define CD_POLYCUSTOM 10
+enum { /* path actions */
+ CD_PATH_NEW,
+ CD_PATH_MOVETO,
+ CD_PATH_LINETO,
+ CD_PATH_ARC,
+ CD_PATH_CURVETO,
+ CD_PATH_CLOSE,
+ CD_PATH_FILL,
+ CD_PATH_STROKE,
+ CD_PATH_FILLSTROKE,
+ CD_PATH_CLIP
+};
+
enum { /* fill mode */
CD_EVENODD,
CD_WINDING
@@ -410,6 +426,8 @@ enum { /* some font sizes */
#define CD_CAP_PALETTE 0x08000000
#define CD_CAP_LINECAP 0x10000000
#define CD_CAP_LINEJOIN 0x20000000
+#define CD_CAP_PATH 0x40000000
+#define CD_CAP_BEZIER 0x80000000
#define CD_CAP_ALL 0xFFFFFFFF
/* cdPlay definitions */
@@ -459,6 +477,18 @@ typedef int(*cdSizeCB)(cdCanvas *canvas, int w, int h, double w_mm, double h_mm)
#define CD_RAD2DEG 57.295779513 /* radians to degrees (deg = CD_RAD2DEG * rad) */
#define CD_DEG2RAD 0.01745329252 /* degrees to radians (rad = CD_DEG2RAD * deg) */
+/* paper sizes */
+enum {
+ CD_A0,
+ CD_A1,
+ CD_A2,
+ CD_A3,
+ CD_A4,
+ CD_A5,
+ CD_LETTER,
+ CD_LEGAL
+};
+
#ifdef __cplusplus
}
diff --git a/cd/include/cd_private.h b/cd/include/cd_private.h
index b9a3243..6138f60 100755
--- a/cd/include/cd_private.h
+++ b/cd/include/cd_private.h
@@ -215,9 +215,13 @@ struct _cdCanvas
cdfPoint* fpoly; /* used during an real poligon creation, only if ->fPoly exists */
int use_fpoly;
+ /* last path */
+ int path_n, /* current number of actions */
+ path_size; /* allocated number of actions, only increases */
+ int* path; /* used during path creation */
+
/* simulation flags */
int sim_mode;
- int sim_poly;
/* WC */
double s, sx, tx, sy, ty; /* Transformacao Window -> Viewport (scale+translation)*/
@@ -264,15 +268,25 @@ enum{CD_CTX_NATIVEWINDOW, CD_CTX_IMAGE, CD_CTX_DBUFFER, CD_CTX_PRINTER, CD_CTX_E
/* utilities */
/*************/
int cdRound(double x);
-void cdCanvasGetEllipseBox(int xc, int yc, int w, int h, double a1, double a2, int *xmin, int *xmax, int *ymin, int *ymax);
int cdCheckBoxSize(int *xmin, int *xmax, int *ymin, int *ymax);
int cdfCheckBoxSize(double *xmin, double *xmax, double *ymin, double *ymax);
void cdNormalizeLimits(int w, int h, int *xmin, int *xmax, int *ymin, int *ymax);
int cdGetFileName(const char* strdata, char* filename);
int cdStrEqualNoCase(const char* str1, const char* str2);
+int cdStrEqualNoCasePartial(const char* str1, const char* str2);
int cdStrLineCount(const char* str);
char* cdStrDup(const char* str);
char* cdStrDupN(const char* str, int len);
+void cdSetPaperSize(int size, double *w_pt, double *h_pt);
+int cdGetFontFileName(const char* font, char* filename);
+
+void cdCanvasPoly(cdCanvas* canvas, int mode, cdPoint* points, int n);
+void cdCanvasGetArcBox(int xc, int yc, int w, int h, double a1, double a2, int *xmin, int *xmax, int *ymin, int *ymax);
+int cdCanvasGetArcPathF(cdCanvas* canvas, const cdPoint* poly, double *xc, double *yc, double *w, double *h, double *a1, double *a2);
+int cdfCanvasGetArcPath(cdCanvas* canvas, const cdfPoint* poly, double *xc, double *yc, double *w, double *h, double *a1, double *a2);
+int cdCanvasGetArcPath(cdCanvas* canvas, const cdPoint* poly, int *xc, int *yc, int *w, int *h, double *a1, double *a2);
+void cdCanvasGetArcStartEnd(int xc, int yc, int w, int h, double a1, double a2, int *x1, int *y1, int *x2, int *y2);
+void cdfCanvasGetArcStartEnd(double xc, double yc, double w, double h, double a1, double a2, double *x1, double *y1, double *x2, double *y2);
#define _cdCheckCanvas(_canvas) (_canvas!=NULL && ((unsigned char*)_canvas)[0] == 'C' && ((unsigned char*)_canvas)[1] == 'D')
#define _cdInvertYAxis(_canvas, _y) (_canvas->h - (_y) - 1)
@@ -288,6 +302,7 @@ void cdMatrixTransformPoint(double* matrix, int x, int y, int *rx, int *ry);
void cdfMatrixTransformPoint(double* matrix, double x, double y, double *rx, double *ry);
void cdMatrixMultiply(const double* matrix, double* mul_matrix);
void cdMatrixInverse(const double* matrix, double* inv_matrix);
+void cdfRotatePoint(cdCanvas* canvas, double x, double y, double cx, double cy, double *rx, double *ry, double sin_theta, double cos_theta);
void cdRotatePoint(cdCanvas* canvas, int x, int y, int cx, int cy, int *rx, int *ry, double sin_teta, double cos_teta);
void cdRotatePointY(cdCanvas* canvas, int x, int y, int cx, int cy, int *ry, double sin_theta, double cos_theta);
void cdTextTranslatePoint(cdCanvas* canvas, int x, int y, int w, int h, int baseline, int *rx, int *ry);
@@ -303,6 +318,11 @@ int cdParseXWinFont(const char *nativefont, char *type_face, int *style, int *si
int cdGetFontSizePixels(cdCanvas* canvas, int size);
int cdGetFontSizePoints(cdCanvas* canvas, int size);
+/* Replacements for Font using estimation */
+/* cdfontex.c */
+void cdgetfontdimEX(cdCtxCanvas* ctxcanvas, int *max_width, int *height, int *ascent, int *descent);
+void cdgettextsizeEX(cdCtxCanvas* ctxcanvas, const char *s, int len, int *width, int *height);
+
/****************/
/* For Images */
/****************/
diff --git a/cd/include/cdcairo.h b/cd/include/cdcairo.h
new file mode 100644
index 0000000..81d54dc
--- /dev/null
+++ b/cd/include/cdcairo.h
@@ -0,0 +1,45 @@
+/** \file
+ * \brief Cairo extra drivers.
+ * Rendering PDF, PS, SVG and IMAGERGB.
+ *
+ * See Copyright Notice in cd.h
+ */
+
+#ifndef __CD_CAIRO_H
+#define __CD_CAIRO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Some of these context can be used directly or by cdInitContextPlus,
+ as CD_NATIVEWINDOW, CD_IMAGE, CD_EMF, CD_PRINTER and CD_DBUFFER.
+ The others only directly.
+*/
+
+cdContext* cdContextCairoNativeWindow(void);
+cdContext* cdContextCairoImage(void);
+cdContext* cdContextCairoDBuffer(void);
+cdContext* cdContextCairoPrinter(void);
+cdContext* cdContextCairoPS(void);
+cdContext* cdContextCairoPDF(void);
+cdContext* cdContextCairoSVG(void);
+cdContext* cdContextCairoImageRGB(void);
+cdContext* cdContextCairoEMF(void);
+
+#define CD_CAIRO_NATIVEWINDOW cdContextCairoNativeWindow()
+#define CD_CAIRO_IMAGE cdContextCairoImage()
+#define CD_CAIRO_DBUFFER cdContextCairoDBuffer()
+#define CD_CAIRO_PRINTER cdContextCairoPrinter()
+#define CD_CAIRO_PS cdContextCairoPS()
+#define CD_CAIRO_PDF cdContextCairoPDF()
+#define CD_CAIRO_SVG cdContextCairoSVG()
+#define CD_CAIRO_IMAGERGB cdContextCairoImageRGB()
+#define CD_CAIRO_EMF cdContextCairoEMF()
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ifndef __CD_CAIRO_ */
diff --git a/cd/include/cdgl.h b/cd/include/cdgl.h
new file mode 100644
index 0000000..946268a
--- /dev/null
+++ b/cd/include/cdgl.h
@@ -0,0 +1,23 @@
+/** \file
+* \brief OpenGL driver
+*
+* See Copyright Notice in cd.h
+*/
+
+#ifndef __CD_GL_H
+#define __CD_GL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+cdContext* cdContextGL(void);
+
+#define CD_GL cdContextGL()
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ifndef __CD_GL_ */
+
diff --git a/cd/include/cdlua.h b/cd/include/cdlua.h
index 30d8174..a353dd8 100755
--- a/cd/include/cdlua.h
+++ b/cd/include/cdlua.h
@@ -29,6 +29,7 @@ int cdlua_close(lua_State *L);
cdCanvas* cdlua_getcanvas(lua_State * L); /* pos=1, deprecated use cdlua_checkcanvas */
cdCanvas* cdlua_checkcanvas(lua_State * L, int pos);
void cdlua_pushcanvas(lua_State * L, cdCanvas* canvas);
+
#endif
#ifdef __cplusplus
diff --git a/cd/include/cdlua5_private.h b/cd/include/cdlua5_private.h
index 974fb4e..3051fb6 100755
--- a/cd/include/cdlua5_private.h
+++ b/cd/include/cdlua5_private.h
@@ -133,6 +133,9 @@ void cdlua_pushbitmap(lua_State* L, cdBitmap* bitmap);
void cdlua_pushimagergb_ex(lua_State* L, unsigned char* red, unsigned char* green, unsigned char* blue, int width, int height);
void cdlua_pushimagergba_ex(lua_State* L, unsigned char* red, unsigned char* green, unsigned char* blue, unsigned char* alpha, int width, int height);
+#if LUA_VERSION_NUM < 502
+#define luaL_typeerror luaL_typerror
+#endif
#ifdef __cplusplus
}
diff --git a/cd/include/cdluagl.h b/cd/include/cdluagl.h
new file mode 100644
index 0000000..412d745
--- /dev/null
+++ b/cd/include/cdluagl.h
@@ -0,0 +1,27 @@
+/** \file
+ * \brief OpenGL Canvas Lua Binding
+ *
+ * See Copyright Notice in cd.h
+ */
+
+#ifndef __CD_LUAGL_H
+#define __CD_LUAGL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef LUA_NOOBJECT /* Lua 3 */
+void cdluagl_open(void);
+#endif
+
+#ifdef LUA_TNONE /* Lua 5 */
+int cdluagl_open(lua_State *L);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/cd/include/cdpdf.h b/cd/include/cdpdf.h
index 70d6df5..89486fc 100755
--- a/cd/include/cdpdf.h
+++ b/cd/include/cdpdf.h
@@ -15,21 +15,6 @@ cdContext* cdContextPDF(void);
#define CD_PDF cdContextPDF()
-#ifndef CD_PAPERSIZE
-#define CD_PAPERSIZE
-enum { /* paper sizes */
- CD_A0,
- CD_A1,
- CD_A2,
- CD_A3,
- CD_A4,
- CD_A5,
- CD_LETTER,
- CD_LEGAL
-};
-#endif
-
-
#ifdef __cplusplus
}
#endif
diff --git a/cd/include/cdps.h b/cd/include/cdps.h
index 180ebad..0f4bdd8 100755
--- a/cd/include/cdps.h
+++ b/cd/include/cdps.h
@@ -15,20 +15,6 @@ cdContext* cdContextPS(void);
#define CD_PS cdContextPS()
-#ifndef CD_PAPERSIZE
-#define CD_PAPERSIZE
-enum { /* paper sizes */
- CD_A0,
- CD_A1,
- CD_A2,
- CD_A3,
- CD_A4,
- CD_A5,
- CD_LETTER,
- CD_LEGAL
-};
-#endif
-
#ifdef __cplusplus
}
#endif