FLTK 1.3.9: Cairo Support Functions and Classes

FLTK 1.3.9

Loading...
Searching...
No Matches
Classes | Functions
Cairo Support Functions and Classes

## Classes
class | Fl_Cairo_State
| Contains all the necessary info on the current cairo context. More...
class | Fl_Cairo_Window
| This defines a pre-configured cairo fltk window. More...

## Functions
static bool | Fl::cairo_autolink_context ()
| Gets the current autolink mode for cairo support.
static void | Fl::cairo_autolink_context (bool alink)
| when FLTK_HAVE_CAIRO is defined and cairo_autolink_context() is true, any current window dc is linked to a current cairo context.
static cairo_t * | Fl::cairo_cc ()
| Gets the current cairo context linked with a fltk window.
static void | Fl::cairo_cc (cairo_t *c, bool own=false)
| Sets the current cairo context to `c`.
static cairo_t * | Fl::cairo_make_current (Fl_Window *w)
| Provides a corresponding cairo context for window wi.

## Detailed Description

## Function Documentation

## ◆ cairo_autolink_context() [1/2]

static bool Fl::cairo_autolink_context | ( |  | ) |
| inlinestatic

Gets the current autolink mode for cairo support.

Return values

  false | if no cairo context autolink is made for each window.
  true | if any fltk window is attached a cairo context when it is current.

See also
  void cairo_autolink_context(bool alink)

Note
  Only available when configure has the –enable-cairo option

## ◆ cairo_autolink_context() [2/2]

static void Fl::cairo_autolink_context | ( | bool | alink | ) |
| inlinestatic

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 but only for this Window. Still in custom cairo application it is possible to handle completely this process automatically by setting `alink` to true. In this last case, you don't need anymore to call Fl::cairo_make_current(). You can use Fl::cairo_cc() to get the current cairo context anytime.

Note
  Only available when configure has the –enable-cairo option

## ◆ cairo_cc()

static void Fl::cairo_cc | ( | cairo_t * | c,
|  | bool | own = `false`
| ) |  |
| inlinestatic

Sets the current cairo context to `c`.

Set `own` to true if you want fltk to handle this cc deletion.

Note
  Only available when configure has the –enable-cairo option

## ◆ cairo_make_current()

cairo_t * Fl::cairo_make_current | ( | Fl_Window * | wi | ) |
| static

Provides a corresponding cairo context for window wi.

This is needed in a draw() override if Fl::cairo_autolink_context() returns false, which is the default. The cairo_context() does not need to be freed as it is freed every time a new cairo context is created. When the program terminates, a call to Fl::cairo_make_current(0) will destroy any residual context.

Note
  A new cairo context is not always re-created when this method is used. In particular, if the current graphical context and the current window didn't change between two calls, the previous gc is internally kept, thus optimizing the drawing performances. Also, after this call, Fl::cairo_cc() is adequately updated with this cairo context.
  Only available when configure has the –enable-cairo option

Returns
  the valid cairo_t* cairo context associated to this window.