FLTK logo

Re: [fltk.coredev] WIP: new Cairo support features

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: WIP: new Cairo support features Albrecht Schlosser Mar 22, 2023  
 
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 ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.