1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/cairo.cpp
3 // Purpose: Cairo library
4 // Author: Anthony Betaudeau
6 // RCS-ID: $Id: cairo.cpp 44625 2007-08-25 11:35:04Z VZ $
7 // Copyright: (c) Anthony Bretaudeau
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
24 #include "wx/module.h"
29 wxCairoLibrary
*wxCairoLibrary::s_lib
= NULL
;
31 //----------------------------------------------------------------------------
33 //----------------------------------------------------------------------------
35 wxCairoLibrary::wxCairoLibrary()
38 m_pango_cairo_lib
= NULL
;
42 m_cairo_lib
= new wxDynamicLibrary( wxT("libcairo.so.2") );
43 m_ok
= m_cairo_lib
->IsLoaded();
46 m_pango_cairo_lib
= new wxDynamicLibrary( wxT("libpangocairo-1.0.so.0") );
47 m_ok
= m_pango_cairo_lib
->IsLoaded();
53 wxCairoLibrary::~wxCairoLibrary()
59 /* static */ wxCairoLibrary
* wxCairoLibrary::Get()
64 s_lib
= new wxCairoLibrary();
74 /* static */ void wxCairoLibrary::CleanUp()
83 bool wxCairoLibrary::IsOk()
88 void wxCairoLibrary::InitializeMethods()
93 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_arc
, success
)
94 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_arc_negative
, success
)
95 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_clip
, success
)
96 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_close_path
, success
)
97 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_create
, success
)
98 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_curve_to
, success
)
99 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_destroy
, success
)
100 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_fill
, success
)
101 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_fill_preserve
, success
)
102 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_get_target
, success
)
103 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_image_surface_create_for_data
, success
)
104 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_line_to
, success
)
105 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_move_to
, success
)
106 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_new_path
, success
)
107 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_paint
, success
)
108 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_pattern_add_color_stop_rgba
, success
)
109 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_pattern_create_for_surface
, success
)
110 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_pattern_create_linear
, success
)
111 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_pattern_create_radial
, success
)
112 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_pattern_destroy
, success
)
113 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_pattern_set_extend
, success
)
114 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_pattern_set_filter
, success
)
115 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_rectangle
, success
)
116 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_reset_clip
, success
)
117 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_restore
, success
)
118 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_rotate
, success
)
119 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_save
, success
)
120 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_scale
, success
)
121 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_set_dash
, success
)
122 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_set_fill_rule
, success
)
123 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_set_line_cap
, success
)
124 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_set_line_join
, success
)
125 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_set_line_width
, success
)
126 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_set_operator
, success
)
127 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_set_source
, success
)
128 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_set_source_rgba
, success
)
129 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_stroke
, success
)
130 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_stroke_preserve
, success
)
131 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_surface_create_similar
, success
)
132 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_surface_destroy
, success
)
133 wxDL_METHOD_LOAD( m_cairo_lib
, cairo_translate
, success
)
135 wxDL_METHOD_LOAD( m_pango_cairo_lib
, pango_cairo_update_layout
, success
)
136 wxDL_METHOD_LOAD( m_pango_cairo_lib
, pango_cairo_show_layout
, success
)
141 //----------------------------------------------------------------------------
143 //----------------------------------------------------------------------------
145 class wxCairoModule
: public wxModule
153 DECLARE_DYNAMIC_CLASS(wxCairoPrintModule
)
156 bool wxCairoModule::OnInit()
161 void wxCairoModule::OnExit()
163 wxCairoLibrary::CleanUp();
166 IMPLEMENT_DYNAMIC_CLASS(wxCairoModule
, wxModule
)