[cairo] Serialization

Talguy talguy385 at gmail.com
Thu Sep 16 08:47:29 PDT 2010


I get good framerates I am just trying to speed up my program start time
instead of parsing a interface configuration file and then create the data
structure based on the file.

On Thu, Sep 16, 2010 at 3:44 AM, Maarten Bosmans <mkbosmans at gmail.com>wrote:

> 2010/9/15 Talguy <talguy385 at gmail.com>:
>  > I have a interface data structure consisting of a list of objects of
> the
> > graphical elements that I manipulate on the screen.  The objects are
> gauges
> > that update with new data 30 times a second.  To help speedup startup
> time
> > of the program I would like to be able to serialize this data structure
> and
> > store it on the disk and then read it back in to the last state of the
> > interface.  My question is how would I serialize the image surfaces,
> > transformation matrics and other cairomm classes that I use in my
> program.
>
> How long does the drawing of all the gauges take, have you measured
> it? I'd imagine that it takes too long to get to a decent framerate,
> so you'll probably need some caching at runtime. But the one time
> effort of drawing your background to an imagesurface is likely not to
> delay your startup significantly. So I'd advise you to measure before
> you optimize!
>
> But to answer your question: image surfaces can be serialized to png
> files or to raw bit data, but in the last case you'll have to store
> the width, height, surface format and possibly stride too. The
> transformation matrix and other cairo_t state you'd be best to just
> set them again at program startup, using the standard cairo functions.
>
> Maarten
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100916/3a12ef59/attachment-0001.html>


More information about the cairo mailing list