2011-12-10 19:28:13 +04:00
|
|
|
README.Cairo.txt - 2011-12-10 - Cairo rendering support for FLTK
|
2010-12-20 23:20:40 +03:00
|
|
|
----------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CONTENTS
|
|
|
|
==========
|
|
|
|
|
|
|
|
1 INTRODUCTION
|
|
|
|
2 CAIRO SUPPORT FOR FLTK 1.3
|
|
|
|
2.1 Configuration
|
|
|
|
2.2 Currently supported features
|
2017-07-05 20:15:16 +03:00
|
|
|
2.3 Future considerations
|
2011-12-09 21:43:50 +04:00
|
|
|
3 PLATFORM SPECIFIC NOTES
|
|
|
|
3.1 Linux
|
|
|
|
3.2 Windows
|
|
|
|
3.3 Mac OSX
|
|
|
|
4 DOCUMENT HISTORY
|
2010-12-20 23:20:40 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-10 19:28:13 +04:00
|
|
|
INTRODUCTION
|
|
|
|
==============
|
2010-12-20 23:20:40 +03:00
|
|
|
|
2017-07-05 20:15:16 +03:00
|
|
|
Cairo is a software library used to provide a vector graphics-based,
|
|
|
|
device-independent API for software developers. It is designed to provide
|
|
|
|
primitives for 2-dimensional drawing across a number of different
|
2011-12-10 19:28:13 +04:00
|
|
|
backends. Cairo is designed to use hardware acceleration when available.
|
2010-12-20 23:20:40 +03:00
|
|
|
|
|
|
|
|
|
|
|
CAIRO SUPPORT FOR FLTK 1.3
|
2011-12-10 19:28:13 +04:00
|
|
|
============================
|
2008-09-25 22:26:33 +04:00
|
|
|
|
2017-07-05 20:15:16 +03:00
|
|
|
It is now possible to integrate cairo rendering in your FLTK application
|
2008-09-25 22:26:33 +04:00
|
|
|
more easily and transparently.
|
|
|
|
In 1.3, we provide minimum support for Cairo,
|
2011-12-10 19:28:13 +04:00
|
|
|
in particular, no "total" cairo rendering layer support is achieved,
|
2008-09-25 22:26:33 +04:00
|
|
|
as in fltk2.
|
|
|
|
|
2010-12-20 23:20:40 +03:00
|
|
|
|
|
|
|
Configuration
|
|
|
|
---------------
|
|
|
|
|
2011-12-10 19:28:13 +04:00
|
|
|
All the changes are *inactive* as long as the new configuration
|
2017-07-05 20:15:16 +03:00
|
|
|
option --enable-cairo is not added to the configure command or the CMake
|
|
|
|
variable OPTION_CAIRO:BOOL=ON is set.
|
2008-09-25 22:26:33 +04:00
|
|
|
|
2010-12-20 23:20:40 +03:00
|
|
|
|
|
|
|
Currently supported features
|
|
|
|
------------------------------
|
|
|
|
|
2017-07-05 20:15:16 +03:00
|
|
|
(1) Adding a new Fl_Cairo_Window class permitting transparent and easy
|
|
|
|
integration of a Cairo draw callback without the need subclass Fl_Window.
|
2008-09-25 22:26:33 +04:00
|
|
|
|
2017-07-05 20:15:16 +03:00
|
|
|
(2) Adding a Fl::cairo_make_current(Fl_Window*) function only providing
|
|
|
|
transparently a cairo context to your custom Fl_Window derived class.
|
|
|
|
This function is intended to be used in your overloaded draw() method.
|
2008-09-25 22:26:33 +04:00
|
|
|
|
2017-07-05 20:15:16 +03:00
|
|
|
(3) Adding an optional cairo autolink context mode support which permits
|
|
|
|
complete and automatic synchronization of OS dependent graphical context
|
|
|
|
and cairo contexts, thus furthering a valid cairo context anytime,
|
|
|
|
in any current window.
|
2008-09-25 22:26:33 +04:00
|
|
|
|
2017-07-05 20:15:16 +03:00
|
|
|
This feature should be only necessary in the following cases:
|
|
|
|
- Intensive and almost systematic use of cairo in an FLTK application
|
|
|
|
- Creation of a new cairo based scheme for FLTK
|
|
|
|
- Other uses of cairo necessitating the FLTK internal instrumentation
|
|
|
|
to automatically making possible the use of a cairo context
|
|
|
|
in any FLTK window.
|
|
|
|
|
|
|
|
This feature must be enabled with 'configure --enable-cairoext' or the
|
|
|
|
CMake variable OPTION_CAIROEXT:BOOL=ON (Default: OFF).
|
|
|
|
|
|
|
|
(4) A new cairo demo that is available in the test subdirectory and has
|
|
|
|
been used as a testcase during the multiplatform tests.
|
2008-09-25 22:26:33 +04:00
|
|
|
|
|
|
|
For more details, please have a look to the doxygen documentation,
|
|
|
|
in the Modules section.
|
|
|
|
|
2010-12-20 23:20:40 +03:00
|
|
|
|
|
|
|
Future considerations
|
|
|
|
-----------------------
|
2008-09-25 22:26:33 +04:00
|
|
|
|
|
|
|
From Bill:
|
2011-01-06 13:24:58 +03:00
|
|
|
First there is the FLTK_HAVE_CAIRO configuration option. This indicates that
|
2008-09-25 22:26:33 +04:00
|
|
|
any cairo calls are available. In this case you get something like this:
|
|
|
|
|
2017-07-05 20:15:16 +03:00
|
|
|
// static variable holding the last cairo context FLTK set:
|
2008-09-25 22:26:33 +04:00
|
|
|
cairo_t* Fl::cr;
|
|
|
|
|
|
|
|
// Make cr draw in this window. This hides the ugly platform-dependent
|
|
|
|
// part of getting cairo going:
|
|
|
|
void Fl::cairo_make_current(Fl_Window*)
|
|
|
|
|
|
|
|
*** POST 1.3 potential cairo use:
|
|
|
|
// Set cr to something you made yourself. This lets you reuse functions
|
2017-07-05 20:15:16 +03:00
|
|
|
// that use cr, and also tells FLTK that cr is not one of its own and
|
2008-09-25 22:26:33 +04:00
|
|
|
// thus cannot be destroyed or reused for a different window:
|
|
|
|
void Fl::cairo_make_current(cairo_t*)
|
|
|
|
|
2011-01-06 13:24:58 +03:00
|
|
|
Second there is the FLTK_USE_CAIRO configuration option. This means that all
|
2008-09-25 22:26:33 +04:00
|
|
|
drawing is done using Cairo. In this case when a widget draw() method is
|
|
|
|
called, it is exactly as though cairo_make_current(window) has been done.
|
2017-07-05 20:15:16 +03:00
|
|
|
***
|
2008-09-25 22:26:33 +04:00
|
|
|
|
2011-12-10 19:28:13 +04:00
|
|
|
Note that it should be possible to compile so FLTK_HAVE_CAIRO works even
|
|
|
|
if FLTK_USE_CAIRO does not, and so that turning on FLTK_USE_CAIRO does not
|
|
|
|
break any programs written for FLTK_HAVE_CAIRO.
|
|
|
|
|
2010-12-20 23:20:40 +03:00
|
|
|
|
2011-12-09 21:43:50 +04:00
|
|
|
PLATFORM SPECIFIC NOTES
|
|
|
|
=========================
|
|
|
|
|
2017-07-05 20:15:16 +03:00
|
|
|
The following are notes about building FLTK with Cairo support
|
2011-12-09 21:43:50 +04:00
|
|
|
on the various supported operating systems.
|
|
|
|
|
|
|
|
3.1 Linux
|
|
|
|
---------
|
|
|
|
|
|
|
|
From Greg (erco@seriss.com):
|
|
|
|
To get FLTK 1.3.x (r9204) to build on Centos 5.5, I found that
|
|
|
|
I only needed to install the "cairo-devel" package, ie:
|
2017-07-05 20:15:16 +03:00
|
|
|
|
2011-12-09 21:43:50 +04:00
|
|
|
sudo yum install cairo-devel
|
|
|
|
|
2017-07-05 20:15:16 +03:00
|
|
|
..and then rebuild FLTK:
|
2011-12-09 21:43:50 +04:00
|
|
|
|
|
|
|
make distclean
|
|
|
|
./configure --enable-cairo
|
|
|
|
make
|
|
|
|
|
|
|
|
If you get this error:
|
|
|
|
|
|
|
|
[..]
|
|
|
|
Linking cairo_test...
|
|
|
|
/usr/bin/ld: cannot find -lpixman-1
|
|
|
|
collect2: ld returned 1 exit status
|
|
|
|
make[1]: *** [cairo_test] Error 1
|
|
|
|
|
2017-07-05 20:15:16 +03:00
|
|
|
..remove "-lpixman-1" from FLTK's makeinclude file, i.e. change this line:
|
2011-12-09 21:43:50 +04:00
|
|
|
|
2011-12-10 19:28:13 +04:00
|
|
|
-CAIROLIBS = -lcairo -lpixman-1
|
2011-12-09 21:43:50 +04:00
|
|
|
+CAIROLIBS = -lcairo
|
|
|
|
|
|
|
|
..then another 'make' should finish the build without errors.
|
|
|
|
You should be able to then run the test/cairo_test program.
|
2017-07-05 20:15:16 +03:00
|
|
|
|
2011-12-10 19:28:13 +04:00
|
|
|
According to the cairo site, "For Debian and Debian derivatives including
|
2011-12-10 19:35:00 +04:00
|
|
|
Ubuntu" you need to install libcairo2-dev, i.e.
|
2011-12-10 19:28:13 +04:00
|
|
|
|
|
|
|
sudo apt-get install libcairo2-dev
|
|
|
|
|
2011-12-10 19:35:00 +04:00
|
|
|
This has been tested and works with Ubuntu 11.10. Note that this also
|
|
|
|
installs libpixman-1-dev, so that dependencies on this should be resolved
|
|
|
|
as well.
|
2011-12-10 19:28:13 +04:00
|
|
|
|
2011-12-09 21:43:50 +04:00
|
|
|
|
|
|
|
3.2 Windows
|
|
|
|
-----------
|
|
|
|
TBD
|
|
|
|
|
2011-12-10 19:28:13 +04:00
|
|
|
|
2011-12-09 21:43:50 +04:00
|
|
|
3.3 Mac OSX
|
|
|
|
-----------
|
|
|
|
TBD
|
|
|
|
|
|
|
|
|
2010-12-20 23:20:40 +03:00
|
|
|
|
|
|
|
DOCUMENT HISTORY
|
|
|
|
==================
|
|
|
|
|
|
|
|
Dec 20 2010 - matt: restructured document
|
2011-12-10 19:28:13 +04:00
|
|
|
Dec 09 2011 - greg: Updates for Centos 5.5 builds
|
|
|
|
Dec 10 2011 - Albrecht: Updates for Ubuntu and Debian, fixed typos.
|
2017-07-05 20:15:16 +03:00
|
|
|
Jul 05 2017 - Albrecht: Added CMake config info, fixed typos.
|