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