[cairo] cairo_surface_show_page

Paolo Bonzini bonzini at gnu.org
Thu Dec 18 01:04:14 PST 2008


David Trallero wrote:
> According to the documentation:
> 
> "Emits and clears the current page for backends that support multiple pages."
> 
> My question is, what happens with backends that do not support multiple
> pages? does It do nothing? If that is the case, I would like to propose to
> compose the content to be shown with the "current" image (yes, there is
> double buffer somewhere). This is useful to compose two images (they may
> have some alpha-values).

To achieve this, you could also just make two different cairo surfaces
for the front and back buffers, and do

front->set_source_surface (back, 0, 0);
back->clean_background( ) ;

for ( i = 0 : i < num_layers ; i ++ )
{
  // paint a layer
  ....
  // Combine the layer (2nd buffer) with the current image (1st
  // visual buffer)
  front->paint ();
}

Not all backends have double-buffering (not even all OpenGL surface; if
you are using Glitz, then you can make different Glitz surfaces for the
front and back buffers of a pbuffer, and create Cairo surfaces from those).

Paolo


More information about the cairo mailing list