Recording Surface, Callback or ..

Edward Zimmermann <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Hi,

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

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

E.g.
draw...
set color  to X
paint
set color to Y
draw...
paint

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
Softwareentwicklung
---
CIB software GmbH
Elektrastr. 6a
81925 München
---
T +49 (0)89 / 1 43 60 - 156
F +49 (0)89 / 1 43 60 -100
[email protected]<mailto:[email protected]>
www.cib.de<http://www.cib.de/>
---
Sitz: München
Registergericht München, HRB 123286
Geschäftsführer: Dipl.-Ing. Ulrich Brandner

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.