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::ms_lib
= NULL
;
31 //----------------------------------------------------------------------------
33 //----------------------------------------------------------------------------
35 wxCairoLibrary::wxCairoLibrary()
39 m_libCairo
.Load("libcairo.so.2");
40 m_ok
= m_libCairo
.IsLoaded();
44 m_libPangoCairo
.Load("libpangocairo-1.0.so.0");
45 m_ok
= m_libPangoCairo
.IsLoaded();
52 m_ok
= InitializeMethods();
55 wxCairoLibrary::~wxCairoLibrary()
59 /* static */ wxCairoLibrary
* wxCairoLibrary::Get()
63 ms_lib
= new wxCairoLibrary();
64 if ( !ms_lib
->IsOk() )
74 /* static */ void wxCairoLibrary::CleanUp()
83 bool wxCairoLibrary::IsOk()
88 bool wxCairoLibrary::InitializeMethods()
90 wxDL_METHOD_LOAD(m_libCairo
, cairo_arc
);
91 wxDL_METHOD_LOAD(m_libCairo
, cairo_arc_negative
);
92 wxDL_METHOD_LOAD(m_libCairo
, cairo_clip
);
93 wxDL_METHOD_LOAD(m_libCairo
, cairo_close_path
);
94 wxDL_METHOD_LOAD(m_libCairo
, cairo_create
);
95 wxDL_METHOD_LOAD(m_libCairo
, cairo_curve_to
);
96 wxDL_METHOD_LOAD(m_libCairo
, cairo_destroy
);
97 wxDL_METHOD_LOAD(m_libCairo
, cairo_fill
);
98 wxDL_METHOD_LOAD(m_libCairo
, cairo_fill_preserve
);
99 wxDL_METHOD_LOAD(m_libCairo
, cairo_get_target
);
100 wxDL_METHOD_LOAD(m_libCairo
, cairo_image_surface_create_for_data
);
101 wxDL_METHOD_LOAD(m_libCairo
, cairo_line_to
);
102 wxDL_METHOD_LOAD(m_libCairo
, cairo_move_to
);
103 wxDL_METHOD_LOAD(m_libCairo
, cairo_new_path
);
104 wxDL_METHOD_LOAD(m_libCairo
, cairo_paint
);
105 wxDL_METHOD_LOAD(m_libCairo
, cairo_pattern_add_color_stop_rgba
);
106 wxDL_METHOD_LOAD(m_libCairo
, cairo_pattern_create_for_surface
);
107 wxDL_METHOD_LOAD(m_libCairo
, cairo_pattern_create_linear
);
108 wxDL_METHOD_LOAD(m_libCairo
, cairo_pattern_create_radial
);
109 wxDL_METHOD_LOAD(m_libCairo
, cairo_pattern_destroy
);
110 wxDL_METHOD_LOAD(m_libCairo
, cairo_pattern_set_extend
);
111 wxDL_METHOD_LOAD(m_libCairo
, cairo_pattern_set_filter
);
112 wxDL_METHOD_LOAD(m_libCairo
, cairo_rectangle
);
113 wxDL_METHOD_LOAD(m_libCairo
, cairo_reset_clip
);
114 wxDL_METHOD_LOAD(m_libCairo
, cairo_restore
);
115 wxDL_METHOD_LOAD(m_libCairo
, cairo_rotate
);
116 wxDL_METHOD_LOAD(m_libCairo
, cairo_save
);
117 wxDL_METHOD_LOAD(m_libCairo
, cairo_scale
);
118 wxDL_METHOD_LOAD(m_libCairo
, cairo_set_dash
);
119 wxDL_METHOD_LOAD(m_libCairo
, cairo_set_fill_rule
);
120 wxDL_METHOD_LOAD(m_libCairo
, cairo_set_line_cap
);
121 wxDL_METHOD_LOAD(m_libCairo
, cairo_set_line_join
);
122 wxDL_METHOD_LOAD(m_libCairo
, cairo_set_line_width
);
123 wxDL_METHOD_LOAD(m_libCairo
, cairo_set_operator
);
124 wxDL_METHOD_LOAD(m_libCairo
, cairo_set_source
);
125 wxDL_METHOD_LOAD(m_libCairo
, cairo_set_source_rgba
);
126 wxDL_METHOD_LOAD(m_libCairo
, cairo_stroke
);
127 wxDL_METHOD_LOAD(m_libCairo
, cairo_stroke_preserve
);
128 wxDL_METHOD_LOAD(m_libCairo
, cairo_surface_create_similar
);
129 wxDL_METHOD_LOAD(m_libCairo
, cairo_surface_destroy
);
130 wxDL_METHOD_LOAD(m_libCairo
, cairo_translate
);
132 wxDL_METHOD_LOAD(m_libPangoCairo
, pango_cairo_update_layout
);
133 wxDL_METHOD_LOAD(m_libPangoCairo
, pango_cairo_show_layout
);
138 //----------------------------------------------------------------------------
140 //----------------------------------------------------------------------------
142 class wxCairoModule
: public wxModule
146 virtual bool OnInit();
147 virtual void OnExit();
150 DECLARE_DYNAMIC_CLASS(wxCairotModule
)
153 bool wxCairoModule::OnInit()
158 void wxCairoModule::OnExit()
160 wxCairoLibrary::CleanUp();
163 IMPLEMENT_DYNAMIC_CLASS(wxCairoModule
, wxModule
)
165 #endif // wxUSE_CAIRO