[cairo] Vector screen capture with Cairo

Peter Clifton pcjc2 at cam.ac.uk
Wed Apr 4 13:23:26 PDT 2007

On Wed, 2007-04-04 at 12:50 +0100, Peter Clifton wrote:
> Hi, I asked this question on the GTK app-devel list, but so far no-one
> has anything to say about it. I get the feeling the solution is quite
> involved technically - either with Cairo or Gdk + GTK internals.

> I want to get a vector-based a window capture of a program for
> in user-documentation. This would produce a nice scalable, (and
> hopefully memory efficient) way to embed the window capture. 

Replying to my own message - must be mad:

I've been playing with an LD_PRELOAD shim between Cairo and my
application, and this has helped to solifify my understanding of the

Each X11 drawable the app wants to paint has a cairo surface created for
it, and subsequently a graphics context.

It is possible for me to intercept (and duplicate / re-direct) all cairo
operations, to build up a .pdf or .ps output for them, but there are a
few issues:

1. I need to have one .pdf or .ps surface, which the little "tiles"
corresponding to various X11 drawables are placed.

2. Since the cairo contexts for the X11 drawables can exist
concurrently, I don't think I can just fiddle a single context to paint
into different areas of my .pdf surface.

So then.. a few questions (from a cairo newbie).

Can I have multiple cairo contexts painting to different areas of
my .pdf surface concurrently?

Can I make a surface backed pattern which can be "painted" onto the .pdf
- or will this rasterize the graphics?


> I realise this isn't "easy", but does any one have any suggestions how
> it might be possible to proceed?

I'm realising this is far from "easy", but it still looks possible. Any
further comments?


Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,

Tel: +44 (0)7729 980173 - (No signal in the lab!)

More information about the cairo mailing list