[cairo] Recording Surface, Callback or ..

Edward Zimmermann Edward.Zimmermann at cib.de
Thu Jan 24 04:26:41 PST 2013


New to the list and already my first question....

I'd like to have the recording surface grab colours to playback from a parent..

set color  to X
set color to Y

When playing it back I'd like to be able to vary X. Like an Andy Warhol pic be able to play back in BLUE, RED,...

There are other clear applications.. In PDF, for example, we have something called Xobjects. These contain a number of
drawing operations and get their stroking and non-stroking (fill) colours from the context into which they are being played
back into.

At the current stage I suspect the only means would be to extend cairo with something like

typedef cairo_status_t (*cairo_callback_func_t) (int which, cairo_t *cr, void *data);

cairo_status_t cairo_callback_set (cairo_t *cr, cairo_callback_func_t callback);
cairo_status_t cairo_callback_call (cairo_t *cr, int which, void *data);

(data is not really needed but I figure maybe it can't hurt even if its means one needs to store a pointer)

the callback could then in the above example set the colors (which choosing which one).. or be used for a host of other
applications, even attach/fetch the user data from surface backing the context.. Putting the callback function into gstate even
lets one push/pop them to one delight..

This extension would be simple enough to do..

Or is there already a means to handle my use case without extending Cairo and I'm just missing the trivial?

Edward C. Zimmermann
CIB software GmbH
Elektrastr. 6a
81925 München
T +49 (0)89 / 1 43 60 - 156
F +49 (0)89 / 1 43 60 -100
edward.zimmermann at cib.de<mailto:edward.zimmermann at cib.de>
Sitz: München
Registergericht München, HRB 123286
Geschäftsführer: Dipl.-Ing. Ulrich Brandner

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20130124/dfcf10ba/attachment.html>

More information about the cairo mailing list