[cairo] Recording commands and playing back?

Stuart Axon stuaxo2 at yahoo.com
Tue Apr 27 03:54:13 PDT 2010

Prior to 1.10, you can 

> actually use a PDF surface with a nul stream to
achieve the same 
> result.

I think my mental model of cairo isn't quite right yet, any idea why this gives me a blank png?

from cairo import PDFSurface, ImageSurface, FORMAT_ARGB32, Context

recording = PDFSurface(None, 200, 200)
target = ImageSurface(FORMAT_ARGB32, 200, 200)

# Record a red rectangle
cr = Context(recording)
cr.set_source_rgb(1.0, 0.0, 1.0)
cr.rectangle(0, 0, 10, 10)

# Replay recording to target
target_context = Context(target)




More information about the cairo mailing list