|
|
On 3/22/23 08:33 Manolo wrote:
Under Wayland, the adequate API already exists :
#include <FL/platform.H>
#ifdef FLTK_USE_WAYLAND
if (fl_wl_display()) { // to avoid when the hybrid library
is in x11 mode
cairo_t *cr = fl_wl_cairo();
cairo_rectangle(cr, x, y, w, h); // for example
}
#endif
returns the cairo_t* quantity that is used in all cairo
fiunction calls.
This function can be called as soon as the [target window or]
image surface has been made current.
Thanks. I knew that this worked with the current window but didn't
know I could apply it to any surface.
I also believe that in
#if defined(_WIN32)
cairo_surface_t *cairo_surface = cairo_win32_surface_create((HDC)fl_gc);
cairo_t *cairo_context = cairo_create(cairo_surface);
return cairo_context;
#endif
there's a missing
statement. This one should go after the cairo_create() call
:
cairo_surface_destroy(cairo_surface);
because cairo objects are reference counted, ...
Thanks for this hint. In my code of class Fl_Cairo2 I'm currently
keeping a pointer to the surface and destroying the surface in the
destructor. I'm not sure which way I'll choose in the final code.
Regarding your later reply: Thanks for the macOS code as well.
I'll try your code and update my branch accordingly.
--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/e65078f4-4394-a03f-ff63-8df20e243f65%40online.de.
[ Direct Link to Message ] | |
|
| |