[cairo] Writing Surface to PNG based on Window Context: POSSIBLE?
darethehair at gmail.com
Fri Mar 20 15:31:27 PDT 2009
OK, for my 2nd newbie question...
I know sortof how to read in a PNG, draw on it, and write it back out
again to another PNG:
from math import pi
s = cairo.ImageSurface.create_from_png('input.png')
p = cairo.SurfacePattern(s)
t = cairo.ImageSurface(cairo.FORMAT_ARGB32, 800, 480)
ctx = cairo.Context(t)
ctx.arc(10,10, 20, 0, 2 * pi)
However, what if my 'context' wasn't an 'ImageSurface', but was instead
ctx = widget.window.cairo_create()
How does one invoke the 'write_to_png' in that situation? The reason I
ask this is that I would like to be able to draw on the 'screen', but
also re-direct to a PNG (or whatever) file if I want to.
P.S. Sorry for the terminology -- all this
context/surface/pattern/source stuff is rather confusing at first...
More information about the cairo