summaryrefslogtreecommitdiff
path: root/src/gdiplus/cdwimgp.cpp
blob: 697ff409fab9b49d52ed2cd08f62987a30c677f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/** \file
 * \brief Windows GDI+ Image Driver
 *
 * See Copyright Notice in cd.h
 */

#include "cdwinp.h"
#include "cdimage.h"
#include <stdlib.h>
#include <stdio.h>


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;
}
}