]>
Commit | Line | Data |
---|---|---|
50fae378 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/cairo.h | |
3 | // Purpose: Cairo library | |
4 | // Author: Anthony Bretaudeau | |
5 | // Created: 2007-08-25 | |
6 | // RCS-ID: $Id: cairo.h 47254 2007-08-25 10:09:52Z VS $ | |
7 | // Copyright: (c) Anthony Bretaudeau | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_CAIRO_H_BASE_ | |
12 | #define _WX_CAIRO_H_BASE_ | |
13 | ||
3df485fd VZ |
14 | // for now GTK+ only |
15 | #ifndef wxUSE_CAIRO | |
16 | #ifdef __WXGTK210__ | |
17 | #define wxUSE_CAIRO 1 | |
18 | #else | |
19 | #define wxUSE_CAIRO 0 | |
20 | #endif | |
50fae378 RR |
21 | #endif |
22 | ||
23 | #if wxUSE_CAIRO | |
24 | ||
25 | #include "wx/dynlib.h" | |
26 | #include <cairo.h> | |
27 | ||
28 | ||
29 | class wxCairoLibrary | |
30 | { | |
31 | public: | |
ced3df77 VZ |
32 | // return the pointer to the global instance of this class or NULL if we |
33 | // failed to load/initialize it | |
34 | static wxCairoLibrary *Get(); | |
35 | ||
36 | ||
37 | // for internal use only | |
50fae378 RR |
38 | static void CleanUp(); |
39 | ||
4d5501cc | 40 | private: |
ced3df77 VZ |
41 | // the single wxCairoLibrary instance or NULL |
42 | static wxCairoLibrary *ms_lib; | |
43 | ||
4d5501cc RR |
44 | wxCairoLibrary(); |
45 | ~wxCairoLibrary(); | |
46 | ||
50fae378 | 47 | bool IsOk(); |
ced3df77 | 48 | bool InitializeMethods(); |
50fae378 | 49 | |
ced3df77 VZ |
50 | wxDynamicLibrary m_libCairo; |
51 | wxDynamicLibrary m_libPangoCairo; | |
50fae378 | 52 | |
ced3df77 VZ |
53 | // true if we successfully loaded the libraries and can use them |
54 | // | |
55 | // note that this field must have this name as it's used by wxDL_XXX macros | |
56 | bool m_ok; | |
50fae378 RR |
57 | |
58 | public: | |
cf509a90 RR |
59 | wxDL_VOIDMETHOD_DEFINE( cairo_arc, |
60 | (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2), (cr, xc, yc, radius, angle1, angle2) ) | |
61 | wxDL_VOIDMETHOD_DEFINE( cairo_arc_negative, | |
62 | (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2), (cr, xc, yc, radius, angle1, angle2) ) | |
63 | wxDL_VOIDMETHOD_DEFINE( cairo_clip, | |
64 | (cairo_t *cr), (cr) ) | |
65 | wxDL_VOIDMETHOD_DEFINE( cairo_close_path, | |
66 | (cairo_t *cr), (cr) ) | |
50fae378 RR |
67 | wxDL_METHOD_DEFINE( cairo_t*, cairo_create, |
68 | (cairo_surface_t *target), (target), NULL) | |
cf509a90 RR |
69 | wxDL_VOIDMETHOD_DEFINE( cairo_curve_to, |
70 | (cairo_t *cr, double x1, double y1, double x2, double y2, double x3, double y3), (cr, x1, y1, x2, y2, x3, y3) ) | |
71 | wxDL_VOIDMETHOD_DEFINE( cairo_destroy, | |
72 | (cairo_t *cr), (cr) ) | |
73 | wxDL_VOIDMETHOD_DEFINE( cairo_fill, | |
74 | (cairo_t *cr), (cr) ) | |
75 | wxDL_VOIDMETHOD_DEFINE( cairo_fill_preserve, | |
76 | (cairo_t *cr), (cr) ) | |
50fae378 RR |
77 | wxDL_METHOD_DEFINE( cairo_surface_t*, cairo_get_target, |
78 | (cairo_t *cr), (cr), NULL) | |
79 | wxDL_METHOD_DEFINE( cairo_surface_t*, cairo_image_surface_create_for_data, | |
80 | (unsigned char *data, cairo_format_t format, int width, int height, int stride), (data, format, width, height, stride), NULL) | |
cf509a90 RR |
81 | wxDL_VOIDMETHOD_DEFINE( cairo_line_to, |
82 | (cairo_t *cr, double x, double y), (cr, x, y) ) | |
83 | wxDL_VOIDMETHOD_DEFINE( cairo_move_to, | |
84 | (cairo_t *cr, double x, double y), (cr, x, y) ) | |
85 | wxDL_VOIDMETHOD_DEFINE( cairo_new_path, | |
86 | (cairo_t *cr), (cr) ) | |
87 | wxDL_VOIDMETHOD_DEFINE( cairo_paint, | |
88 | (cairo_t *cr), (cr) ) | |
89 | wxDL_VOIDMETHOD_DEFINE( cairo_pattern_add_color_stop_rgba, | |
90 | (cairo_pattern_t *pattern, double offset, double red, double green, double blue, double alpha), (pattern, offset, red, green, blue, alpha) ) | |
50fae378 RR |
91 | wxDL_METHOD_DEFINE( cairo_pattern_t*, cairo_pattern_create_for_surface, |
92 | (cairo_surface_t *surface), (surface), NULL) | |
93 | wxDL_METHOD_DEFINE( cairo_pattern_t*, cairo_pattern_create_linear, | |
94 | (double x0, double y0, double x1, double y1), (x0, y0, x1, y1), NULL) | |
95 | wxDL_METHOD_DEFINE( cairo_pattern_t*, cairo_pattern_create_radial, | |
96 | (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1), (cx0, cy0, radius0, cx1, cy1, radius1), NULL) | |
cf509a90 RR |
97 | wxDL_VOIDMETHOD_DEFINE( cairo_pattern_destroy, |
98 | (cairo_pattern_t *pattern), (pattern) ) | |
99 | wxDL_VOIDMETHOD_DEFINE( cairo_pattern_set_extend, | |
100 | (cairo_pattern_t *pattern, cairo_extend_t extend), (pattern, extend) ) | |
101 | wxDL_VOIDMETHOD_DEFINE( cairo_pattern_set_filter, | |
102 | (cairo_pattern_t *pattern, cairo_filter_t filter), (pattern, filter) ) | |
103 | wxDL_VOIDMETHOD_DEFINE( cairo_rectangle, | |
104 | (cairo_t *cr, double x, double y, double width, double height), (cr, x, y, width, height) ) | |
fc2bb342 VS |
105 | wxDL_METHOD_DEFINE( cairo_t*, cairo_reference, |
106 | (cairo_t *cr), (cr), NULL ) | |
ced3df77 VZ |
107 | wxDL_VOIDMETHOD_DEFINE( cairo_reset_clip, |
108 | (cairo_t *cr), (cr) ) | |
109 | wxDL_VOIDMETHOD_DEFINE( cairo_restore, | |
110 | (cairo_t *cr), (cr) ) | |
111 | wxDL_VOIDMETHOD_DEFINE( cairo_rotate, | |
112 | (cairo_t *cr, double angle), (cr, angle) ) | |
113 | wxDL_VOIDMETHOD_DEFINE( cairo_save, | |
114 | (cairo_t *cr), (cr) ) | |
115 | wxDL_VOIDMETHOD_DEFINE( cairo_scale, | |
116 | (cairo_t *cr, double sx, double sy), (cr, sx, sy) ) | |
117 | wxDL_VOIDMETHOD_DEFINE( cairo_set_dash, | |
118 | (cairo_t *cr, const double *dashes, int num_dashes, double offset), (cr, dashes, num_dashes, offset) ) | |
119 | wxDL_VOIDMETHOD_DEFINE( cairo_set_fill_rule, | |
120 | (cairo_t *cr, cairo_fill_rule_t fill_rule), (cr, fill_rule) ) | |
121 | wxDL_VOIDMETHOD_DEFINE( cairo_set_line_cap, | |
122 | (cairo_t *cr, cairo_line_cap_t line_cap), (cr, line_cap) ) | |
123 | wxDL_VOIDMETHOD_DEFINE( cairo_set_line_join, | |
124 | (cairo_t *cr, cairo_line_join_t line_join), (cr, line_join) ) | |
125 | wxDL_VOIDMETHOD_DEFINE( cairo_set_line_width, | |
126 | (cairo_t *cr, double width), (cr, width) ) | |
127 | wxDL_VOIDMETHOD_DEFINE( cairo_set_operator, | |
128 | (cairo_t *cr, cairo_operator_t op), (cr, op) ) | |
129 | wxDL_VOIDMETHOD_DEFINE( cairo_set_source, | |
130 | (cairo_t *cr, cairo_pattern_t *source), (cr, source) ) | |
131 | wxDL_VOIDMETHOD_DEFINE( cairo_set_source_rgba, | |
132 | (cairo_t *cr, double red, double green, double blue, double alpha), (cr, red, green, blue, alpha) ) | |
cf509a90 RR |
133 | wxDL_VOIDMETHOD_DEFINE( cairo_stroke, |
134 | (cairo_t *cr), (cr) ) | |
135 | wxDL_VOIDMETHOD_DEFINE( cairo_stroke_preserve, | |
136 | (cairo_t *cr), (cr) ) | |
50fae378 RR |
137 | wxDL_METHOD_DEFINE( cairo_surface_t*, cairo_surface_create_similar, |
138 | (cairo_surface_t *other, cairo_content_t content, int width, int height), (other, content, width, height), NULL) | |
cf509a90 RR |
139 | wxDL_VOIDMETHOD_DEFINE( cairo_surface_destroy, |
140 | (cairo_surface_t *surface), (surface) ) | |
141 | wxDL_VOIDMETHOD_DEFINE( cairo_translate, | |
142 | (cairo_t *cr, double tx, double ty), (cr, tx, ty) ) | |
143 | ||
144 | wxDL_VOIDMETHOD_DEFINE( pango_cairo_update_layout, | |
145 | (cairo_t *cr, PangoLayout *layout), (cr, layout) ) | |
146 | wxDL_VOIDMETHOD_DEFINE( pango_cairo_show_layout, | |
147 | (cairo_t *cr, PangoLayout *layout), (cr, layout) ) | |
50fae378 RR |
148 | |
149 | DECLARE_NO_COPY_CLASS(wxCairoLibrary) | |
150 | }; | |
151 | ||
ced3df77 | 152 | #endif // wxUSE_CAIRO |
50fae378 | 153 | |
ced3df77 | 154 | #endif // _WX_CAIRO_H_BASE_ |