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
113
114
115
116
117
118
119
120
121
122
123
124
|
#ifndef _CAIROCANVAS_CAIRO_HXX
#define _CAIROCANVAS_CAIRO_HXX
#ifdef QUARTZ
// needed because sysdata.hxx contains native NS* classes
#include "premac.h"
#include <Cocoa/Cocoa.h>
#include "postmac.h"
#endif
#include <cairo.h>
#ifdef CAIRO_HAS_WIN32_SURFACE
// needed because sysdata.hxx contains native types
#include <tools/prewin.h>
#include <windows.h>
#include <tools/postwin.h>
#undef min
#undef max
#endif
#include <vcl/virdev.hxx>
#include <vcl/sysdata.hxx>
#include <vcl/bitmap.hxx>
#include <stdio.h>
namespace cairo {
// There are some different code paths with Cairo < 1.2.0 (only supported on XLib)
#if (CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 2, 0))
#define USE_CAIRO10_APIS 1
#endif
typedef cairo_t Cairo;
typedef cairo_matrix_t Matrix;
typedef cairo_format_t Format;
typedef cairo_content_t Content;
typedef cairo_pattern_t Pattern;
#if defined(CAIRO_HAS_XLIB_SURFACE) && !defined (QUARTZ)
bool HasXRender( const void* pSysData );
#endif
class Surface {
int mnRefCount;
#if defined QUARTZ
// nothing needed
#elif defined (CAIRO_HAS_XLIB_SURFACE)
#ifdef USE_CAIRO10_APIS
const void* mpSysData;
void* mpDisplay;
long mhDrawable;
void *mpRenderFormat;
bool mbFreePixmap;
#endif
#elif defined (CAIRO_HAS_WIN32_SURFACE)
// nothing needed
#endif
public:
cairo_surface_t* mpSurface;
#if defined(USE_CAIRO10_APIS) && defined(CAIRO_HAS_XLIB_SURFACE) && !defined(QUARTZ)
Surface( const void* pSysData, void* pDisplay, long hDrawable, void* pRenderFormat, cairo_surface_t* pSurface );
#endif
explicit Surface( cairo_surface_t* pSurface );
Surface( const SystemEnvData* pSysData, int x, int y, int width, int height );
Surface( const SystemEnvData* pSysData, const BitmapSystemData* pBmpData, int width, int height );
~Surface();
void Ref()
{
mnRefCount ++;
}
void Unref()
{
mnRefCount --;
if( mnRefCount <= 0 )
delete this;
}
Cairo* getCairo();
Surface* getSimilar( Content aContent, int width, int height );
VirtualDevice* createVirtualDevice();
void fillSystemGraphicsData( SystemGraphicsData& data );
int getDepth();
#if defined(CAIRO_HAS_XLIB_SURFACE) && !defined (QUARTZ)
#if defined USE_CAIRO10_APIS
long getPixmap()
{
return mhDrawable;
}
void* getRenderFormat()
{
return mpRenderFormat;
}
#endif
int getXFormat( Content aContent );
// use only for surfaces made on X Drawables
void Resize( int width, int height );
#endif
#ifdef UNX
// Only used by Xlib and the current Mac OS X Quartz implementation
void flush(const SystemEnvData* pSysData);
#endif
}; // class Surface
} // namespace cairo
#endif
|