[cairo] cairo as an immediate base for retained API and gsave/grestore

viczh viczh at myway.com
Wed Jul 21 18:06:55 PDT 2004

Yes, I have perfect understanding that cairo now does not implement
retained mode API.
The point of my message (may be I was not clear enough) is that
implicit objects and gsave/grestore mechanism unnesessarily
complicate CREATION of such interface over exisitng immediate mode

Suppose you are implementing hypothetical cairo_canvas.
Currently, for handling expose events you should keep full
description of an object to be ready to convert it into path and
render it. But you probably need this high-level description anyway,
to be able to handle object modifications. But how do you handle
hit tests? By keeping bounding boxes separately, doing first round
by bboxes and then instantiate candidates as paths and test against

So it is possible, but a bit cumbersome.

In case of explicit paths, when creating a retained-mode object you
create an appropriate immediate mode counterpart (equivalent of
display list) and when handling expose event you just run this
display list, and you can hit test against all existing path objects
in single call.

I just wanted to understand logic behind this decision to keep
implicit paths in graphic state and have gsave/grestore.
Is it just copied from PostScript? If so, for what reason? Resource
handling? Closeness to well-know model?

As far as I know, no other immediate-mode interface has implicit
paths. I suspect that they were introduced in PosctScript to avoid
giving them names.

No banners. No pop-ups. No kidding.
Make My Way your home on the Web - http://www.myway.com

More information about the cairo mailing list