[cairo] Setting a background "layer"

mike e Toqoz at hotmail.com
Tue Jan 17 02:47:30 UTC 2017


Hello, I'm not that experienced with cairo.


Currently I have a program that draws a background, and then draws some text over that background.  The text moves around over the background.  The image is redrawn often (multiple times a second).


The background is generated through cairo, it is not an image or something like that.


What is the most efficient way to accomplish this?  I know that I could set the paint operator to source and redraw everything each frame, but it seems inefficient.

Is there a way to draw a layer, and then save that layer indefinitely (or have a layer dedicated to the text)?  So that then I could just clear just the text each time and draw it in a new location?


I'm using Xlib and drawing to an window through cairo_xlib_surface_create().


Heres what I'm basically trying to do:


    if (firstrun) {

        draw_background();

    }


    clear_text();

    draw_text(new_location);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20170117/07673524/attachment.html>


More information about the cairo mailing list