Re: What is the closure in stream output to file based surfaces for?

Bill Spitzak <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Though it could be something more complicated, usually the closure is an 
object in C++. This allows the same callback to be used for multiple 
instances:

cairo_status_t write_func(void* closure, const unsigned char* data, 
unsigned len)
{
    ((MyOutputClass*)closure)->write(data, len);
}

...
   MyOutputClass x;
   cairo_surface_write_to_png_stream (surface, write_func, (void*)(&x));
...
-- 
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.