From b7d97c7ed82f0d0472cf0c2ae5d61e99a73b33a8 Mon Sep 17 00:00:00 2001 From: scuri Date: Wed, 12 May 2010 20:38:46 +0000 Subject: New Cairo driver --- include/cd.h | 14 +++++++++++++- include/cd_private.h | 2 ++ include/cdcairo.h | 41 +++++++++++++++++++++++++++++++++++++++++ include/cdpdf.h | 15 --------------- include/cdps.h | 14 -------------- 5 files changed, 56 insertions(+), 30 deletions(-) create mode 100644 include/cdcairo.h (limited to 'include') diff --git a/include/cd.h b/include/cd.h index b3a8784..8d3826c 100644 --- a/include/cd.h +++ b/include/cd.h @@ -21,7 +21,7 @@ extern "C" { #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_DATE "2010/01/26" /* does not include bug fix releases */ typedef struct _cdContext cdContext; typedef struct _cdCanvas cdCanvas; @@ -460,6 +460,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/include/cd_private.h b/include/cd_private.h index af216c5..a70469c 100644 --- a/include/cd_private.h +++ b/include/cd_private.h @@ -273,6 +273,7 @@ int cdStrEqualNoCase(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); #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 +289,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); diff --git a/include/cdcairo.h b/include/cdcairo.h new file mode 100644 index 0000000..2d01f2e --- /dev/null +++ b/include/cdcairo.h @@ -0,0 +1,41 @@ +/** \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 and CD_DBUFFER. + The other only directly. +*/ + +cdContext* cdContextCairoPS(void); +cdContext* cdContextCairoPDF(void); +cdContext* cdContextCairoSVG(void); +cdContext* cdContextCairoImageRGB(void); +cdContext* cdContextCairoDBuffer(void); +cdContext* cdContextCairoImage(void); +cdContext* cdContextCairoNativeWindow(void); + +#define CD_CAIRO_NATIVEWINDOW cdContextCairoNativeWindow() +#define CD_CAIRO_IMAGE cdContextCairoImage() +#define CD_CAIRO_DBUFFER cdContextCairoDBuffer() +#define CD_CAIRO_PS cdContextCairoPS() +#define CD_CAIRO_PDF cdContextCairoPDF() +#define CD_CAIRO_SVG cdContextCairoSVG() +#define CD_CAIRO_IMAGERGB cdContextCairoImageRGB() + + +#ifdef __cplusplus +} +#endif + +#endif /* ifndef __CD_CAIRO_ */ diff --git a/include/cdpdf.h b/include/cdpdf.h index 70d6df5..89486fc 100644 --- a/include/cdpdf.h +++ b/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/include/cdps.h b/include/cdps.h index 180ebad..0f4bdd8 100644 --- a/include/cdps.h +++ b/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 -- cgit v1.2.3