Re: Cairo to Wayland

Tarnyko <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Hi Mike, 

Cairo supports Wayland directly, mast notably via its EGL backend, by using 
the Wayland "wl_egl_window" abstraction.
Creation order is like this : wl_egl_window -> EGLSurface -> cairo_surface_t 
. 

Here is simplified C sample code : 

EGLDisplay edpy;
EGLConfig ecfg;
EGLContext ectx;
EGLSurface esrf;
/* - Wayland - */
struct wl_surface *wlsurface;
struct wl_egl_window *wlwindow;
/* - Cairo - */
cairo_device_t *device;
cairo_surface_t *surface;
cairo_t *cr; 

wlsurface =  wl_compositor_create_surface (wlcompositor);
wlwindow = wl_egl_window_create (wlsurface, 320, 240); 

 /* create egl display context (edpy, ecfg, ectx) here ... */
esrf = eglCreateWindowSurface (edpy, ecfg, wlwindow, NULL); 

device = cairo_egl_device_create (edpy, ectx);
surface = cairo_gl_surface_create_for_egl (device, esrf, 320, 240);
cr = cairo_create (surface);
cairo_rectangle (cr, 0, 0, 320, 240);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_paint (cr); 


I hope it helps.
Regards, Tarnyko 

Mike Gran writes: 

> Hi all, 
> 
> This might be more of a Wayland question than a Cairo question, but... 
> 
> If I wanted to use Cairo to draw a raw Wayland client window,
> what is the most efficient pathway?  For a CPU solution,
> I could have Cairo draw to an in-memory RGB array and then
> send the damaged part of that array to Wayland. 
> 
> But if there to directly interoperate between Wayland and
> Cairo?  Can I have both of them looking at the same EGL surface
> or the same location in RAM or VRAM? 
> 
> Regards,
> Mike Gran
> -- 
> cairo mailing list
> [email protected]
> https://lists.cairographics.org/mailman/listinfo/cairo
-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.