From caaa11a96f8448bd78cb270e4861f5e9ff1a6763 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Thu, 13 Apr 2023 10:02:40 +0200 Subject: Standardize API to "graphics context" across platforms Rename fl_wl_cairo() to fl_wl_gc() Add function cairo_t* fl_cairo_gc() under OPTION_USE_CAIRO --- FL/wayland.H | 2 +- FL/x11.H | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'FL') diff --git a/FL/wayland.H b/FL/wayland.H index 9d2b48925..34098a9d5 100644 --- a/FL/wayland.H +++ b/FL/wayland.H @@ -35,7 +35,7 @@ extern FL_EXPORT struct wld_window *fl_wl_xid(const Fl_Window *win); /** Returns the Fl_Window corresponding to a given the platform-specific window reference */ extern FL_EXPORT Fl_Window *fl_wl_find(struct wld_window *); /** Returns the cairo context associated to the current window or Fl_Image_Surface */ -extern FL_EXPORT cairo_t *fl_wl_cairo(); +extern FL_EXPORT cairo_t *fl_wl_gc(); /** Returns the wl_compositor of the current Wayland session. This allows, for example, to create a wl_surface with \code diff --git a/FL/x11.H b/FL/x11.H index a86b605f2..73af4e7fc 100644 --- a/FL/x11.H +++ b/FL/x11.H @@ -32,7 +32,8 @@ extern Window fl_x11_xid(const Fl_Window *win); extern Fl_Window *fl_x11_find(Window xid); /** Returns the X11-specific currently active graphics context. */ extern GC fl_x11_gc(); - +/** Returns the Cairo-specific currently active graphics context (OPTION_USE_CAIRO=On) */ +extern cairo_t* fl_cairo_gc(); #else // ! FL_DOXYGEN #ifndef FL_PLATFORM_H @@ -65,6 +66,10 @@ extern FL_EXPORT Colormap fl_colormap; // drawing functions: extern FL_EXPORT GC fl_gc; +#if FLTK_USE_CAIRO + typedef struct _cairo cairo_t; + extern FL_EXPORT cairo_t* fl_cairo_gc(); +#endif extern FL_EXPORT GC fl_x11_gc(); FL_EXPORT ulong fl_xpixel(Fl_Color i); FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b); -- cgit v1.2.3