[cairo] cairo with X11\Xrender backend, mask for drawing

Alexei Babich a.babich at rez.ru
Sat Nov 22 01:53:29 PST 2008

Hi all,
I use cairo with X11\XRender backend.
The problem is how to perfom the most efficient masking of displayed image like in the cenario below. ARM platform is used, FPU is software emulated within Linux core, so I would like to minimize all possible calculations on both float point numbers and internal X-server operations.

1. surface = (cairo_surface_t *) cairo_xlib_surface_create(display, w, visual, size_x, size_y);
cr = cairo_create(surface);
cairo_set_source_rgb (cr, 0,1,0);
cairo_scale(cr, size_x, size_y);
cairo_set_line_width(cr, 0.002);
cairo_rectangle(cr, 0.4,0.4,0.2,0.2); //Here would be possibly more complicated (not rectangle) drawing; it would be once created and be partially redrawed within the mask each time Xdamage events are handled

2. while(1){
 XNextEvent (display, &report);  //awaiting events
  __set_drawing(X11_compositing)_mask_by_parameters_got_from_Xdamage_event__ ?? Should the features of cairo be used (if it's possible) or XRender directly? (Is there some working tricks?)
 cairo_restore(cr);   //restoring the path
 cairo_save(cr);     //saving the path for future Xdamage events to be handled

I tryed to use cairo_clip(cr), but it's still unclear to me, how to set the definition of rectangular mask separated from the given path. I need to have the path of drawing saved (not to create it over and over again) and to create a different mask every time before using cairo_stroke().

Thank you.
Alexei Babich, circuit engineer, OOO NPP "Rezonans", Chelyabinsk, Russia
Jabber ID: impatt at jabber.ru

More information about the cairo mailing list