diff options
author | scuri <scuri> | 2010-05-12 20:38:46 +0000 |
---|---|---|
committer | scuri <scuri> | 2010-05-12 20:38:46 +0000 |
commit | b7d97c7ed82f0d0472cf0c2ae5d61e99a73b33a8 (patch) | |
tree | 0da03500210df1ac835203e2bb83748564e67423 /src/cairo/cdcairoimg.c | |
parent | afaff9e085b51c822f0ce31ac91cc8196bfa5113 (diff) |
New Cairo driver
Diffstat (limited to 'src/cairo/cdcairoimg.c')
-rw-r--r-- | src/cairo/cdcairoimg.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/cairo/cdcairoimg.c b/src/cairo/cdcairoimg.c new file mode 100644 index 0000000..54c2fa7 --- /dev/null +++ b/src/cairo/cdcairoimg.c @@ -0,0 +1,52 @@ +/** \file + * \brief Cairo Image Driver + * + * See Copyright Notice in cd.h + */ + +#include <stdlib.h> + +#include "cdcairoctx.h" +#include "cdimage.h" + + +static void cdkillcanvas(cdCtxCanvas* ctxcanvas) +{ + cdcairoKillCanvas(ctxcanvas); +} + +static void cdcreatecanvas(cdCanvas* canvas, void *data) +{ + cdCtxImage *ctximage = ((cdImage*)data)->ctximage; + cdcairoCreateCanvas(canvas, (cairo_t*)ctximage->img); + canvas->w = ctximage->w; + canvas->h = ctximage->h; + canvas->w_mm = ctximage->w_mm; + canvas->h_mm = ctximage->h_mm; + canvas->bpp = ctximage->bpp; + canvas->xres = ctximage->xres; + canvas->yres = ctximage->yres; +} + +static void cdinittable(cdCanvas* canvas) +{ + cdcairoInitTable(canvas); + + canvas->cxKillCanvas = cdkillcanvas; +} + +static cdContext cdImageContext = +{ + CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES ), + 0, + cdcreatecanvas, + cdinittable, + NULL, + NULL +}; + + +cdContext* cdContextCairoImage(void) +{ + return &cdImageContext; +} |