diff options
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl.H | 8 | ||||
| -rw-r--r-- | FL/Fl_Cairo.H | 30 |
2 files changed, 18 insertions, 20 deletions
@@ -1295,19 +1295,19 @@ int main() { static int use_high_res_GL() { return use_high_res_GL_; } #ifdef FLTK_HAVE_CAIRO - /** \defgroup group_cairo Cairo support functions and classes + /** \defgroup group_cairo Cairo Support Functions and Classes @{ */ public: // Cairo support API static cairo_t * cairo_make_current(Fl_Window* w); - /** when FLTK_HAVE_CAIRO is defined and cairo_autolink_context() is true, - any current window dc is linked to a current context. + /** when FLTK_HAVE_CAIRO is defined and cairo_autolink_context() is true, + any current window dc is linked to a current cairo context. This is not the default, because it may not be necessary to add cairo support to all fltk supported windows. When you wish to associate a cairo context in this mode, you need to call explicitly in your draw() overridden method, - FL::cairo_make_current(Fl_Window*). This will create a cairo context + Fl::cairo_make_current(Fl_Window*). This will create a cairo context but only for this Window. Still in custom cairo application it is possible to handle completely this process automatically by setting \p alink to true. diff --git a/FL/Fl_Cairo.H b/FL/Fl_Cairo.H index 10e68392a..1994f0e5e 100644 --- a/FL/Fl_Cairo.H +++ b/FL/Fl_Cairo.H @@ -3,7 +3,7 @@ // // Main header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2016 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -29,17 +29,7 @@ # include <FL/Fl_Export.H> -#if defined(USE_X11) // X11 -# include <cairo-xlib.h> -#elif defined(WIN32) -# include <cairo-win32.h> -#elif defined(__APPLE_QUARTZ__) // PORTME: Cairo Support -# include <cairo-quartz.h> -#elif defined(FL_PORTING) -# pragma message "FL_PORTING: is the Cairo library available on this platform?" -#else -# error Cairo is not supported on that platform. -#endif +# include <cairo.h> /** \addtogroup group_cairo @@ -60,9 +50,16 @@ public: // access attributes cairo_t* cc() const {return cc_;} ///< Gets the current cairo context bool autolink() const {return autolink_;} ///< Gets the autolink option. See Fl::cairo_autolink_context(bool) - /** Sets the current cairo context, \p own indicates cc deletion is handle externally by user */ - void cc(cairo_t* c, bool own=true) { - if (cc_ && own_cc_) cairo_destroy(cc_); + /** Sets the current cairo context. + + \p own == \e true (the default) indicates that the cairo context \p c + will be deleted by FLTK internally when another cc is set later. + + \p own == \e false indicates cc deletion is handled externally + by the user program. + */ + void cc(cairo_t* c, bool own=true) { + if (cc_ && own_cc_) cairo_destroy(cc_); cc_=c; if (!cc_) window_=0; own_cc_=own; @@ -76,7 +73,8 @@ public: private: cairo_t * cc_; // contains the unique autoupdated cairo context bool own_cc_; // indicates whether we must delete the cc, useful for internal cleanup - bool autolink_; // true by default, permits to prevent the automatic cairo mapping on fltk windows for custom cairo implementations + bool autolink_; // false by default, prevents the automatic cairo mapping on fltk windows + // for custom cairo implementations. void* window_, *gc_; // for keeping track internally of last win+gc treated }; |
