summaryrefslogtreecommitdiff
path: root/src/gdiplus/cdwinp.h
blob: 0c4ae551b8cb9c77fd1263294d0d8e86340e3003 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/** \file
 * \brief Windows GDI+ Base Driver
 *
 * See Copyright Notice in cd.h
 */

#ifndef __CDWINP_H
#define __CDWINP_H

#include <windows.h>
#include <gdiplus.h>
using namespace Gdiplus;

#include "cd.h"
#include "cd_private.h"
 

/* Contexto de cada imagem no servidor */
struct _cdCtxImage
{
  Bitmap  *bitmap;     /* bitmap associado                            */
  int      w;          /* largura da imagem                           */
  int      h;          /* altura da imagem                            */
  double w_mm, h_mm;   /* size in mm                                  */                  
  double xres, yres;   /* resolution in pixels/mm                     */     
  int bpp;
  unsigned char* alpha; /* the alpha values must be stored here to be used at putimage */
}; 

/* Contexto de todos os canvas GDI+ (CanvasContext). */
struct _cdCtxCanvas
{
  cdCanvas* canvas;
  
  Graphics *graphics;

  Pen   *linePen;
  SolidBrush *lineBrush;
  Brush *fillBrush;
  Color fg, bg;      /* foreground, backgound                        */
  Font  *font;
  
  struct 
  {
    int height;        
    int ascent;        
    int descent;  
  } fontinfo;
  
  Point *clip_poly; /* coordenadas do pixel no X,Y                  */
  int clip_poly_n;       /* numero de pontos correntes                   */
  Region *clip_region;

  Region *new_region;

  int max_points;
  PointF *wdpoly;  // cache buffer for wdpoly
  Point *cdpoly;   // alias to cache buffer (float=int)

  int antialias;

  Point gradient[2];

  Color pathGradient[500];

  int img_format;
  unsigned char* img_alpha;

  float  rotate_angle;
  int    rotate_center_x,
         rotate_center_y;

  Point img_points[3];
  int use_img_points;

  Color img_transp[2];
  int use_img_transp;

  int wtype;               /* Flag indicando qual o tipo de superficie */ 

  HWND hWnd; /* CDW_WIN handle */
  HDC hDC;   /* GDI Device Context handle */            
  int release_dc;

  HANDLE printerHandle;  // Used by the printer driver

  Metafile* metafile;    /* CDW_EMF handle */
  Bitmap* bitmap;        /* CDW_BMP handle */

  int dirty;             // Used by the double buffer driver
  CachedBitmap* bitmap_dbuffer; /* not the image_dbuffer, just a cache */
  cdCanvas* canvas_dbuffer;
};

enum{CDW_WIN, CDW_BMP, CDW_EMF};

cdCtxCanvas *cdwpCreateCanvas(cdCanvas* canvas, Graphics* graphics, int wtype);
void cdwpKillCanvas(cdCtxCanvas* ctxcanvas);

void cdwpInitTable(cdCanvas* canvas);
void cdwpUpdateCanvas(cdCtxCanvas* canvas);

WCHAR* cdwpString2Unicode(const char* s, int len);
void cdwpShowStatus(const char* title, Status status);

extern "C" {
void cdwpGdiPlusStartup(int debug);
void cdwpGdiPlusShutdown(void);
}

#endif /* ifndef CDWINP_H */