diff options
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; +} |