From d577d991b97ae2b5ee1af23641bcffc3f83af5b2 Mon Sep 17 00:00:00 2001 From: Pixel Date: Wed, 4 Nov 2009 11:56:41 -0800 Subject: Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux. --- cd/src/gdiplus/cdwimgp.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 cd/src/gdiplus/cdwimgp.cpp (limited to 'cd/src/gdiplus/cdwimgp.cpp') diff --git a/cd/src/gdiplus/cdwimgp.cpp b/cd/src/gdiplus/cdwimgp.cpp new file mode 100755 index 0000000..697ff40 --- /dev/null +++ b/cd/src/gdiplus/cdwimgp.cpp @@ -0,0 +1,65 @@ +/** \file + * \brief Windows GDI+ Image Driver + * + * See Copyright Notice in cd.h + */ + +#include "cdwinp.h" +#include "cdimage.h" +#include +#include + + +static void cdkillcanvas (cdCtxCanvas* ctxcanvas) +{ + cdwpKillCanvas(ctxcanvas); + delete ctxcanvas; +} + +static void cdcreatecanvas(cdCanvas* canvas, void *data) +{ + if (data == NULL) + return; + + cdCtxImage* ctximage = ((cdImage*)data)->ctximage; + + /* Inicializa parametros */ + if (ctximage == NULL) + return; + + Graphics* graphics = new Graphics(ctximage->bitmap); + + canvas->w = ctximage->w; + canvas->h = ctximage->h; + canvas->bpp = ctximage->bpp; + + /* Inicializa driver Image */ + cdCtxCanvas* ctxcanvas = cdwpCreateCanvas(canvas, graphics, CDW_BMP); + + ctxcanvas->bitmap = ctximage->bitmap; +} + +static void cdinittable(cdCanvas* canvas) +{ + cdwpInitTable(canvas); + + canvas->cxKillCanvas = cdkillcanvas; +} + +static cdContext cdImageContext = +{ + CD_CAP_ALL & ~(CD_CAP_FLUSH | CD_CAP_PLAY | CD_CAP_YAXIS | + CD_CAP_FPRIMTIVES ), + 1, + cdcreatecanvas, + cdinittable, + NULL, + NULL, +}; + +extern "C" { +cdContext* cdContextImagePlus(void) +{ + return &cdImageContext; +} +} -- cgit v1.2.3