[cairo] cairo internal design ideas

Carl Worth cworth at east.isi.edu
Wed Sep 22 16:07:00 PDT 2004

On Tue, 21 Sep 2004 12:56:21 +0200, David Reveman wrote:
> I've got some ideas for how we could change the internal design of cairo
> to make it more efficient, more flexible and solve some the problems
> that currently exist. Comments and suggestions are as always much
> appreciated.


Thanks so much for looking into this. This kind of rework is exactly
what we had in mind when we decided to make the backend interface an
implmentation detail rather than a public export. I'm glad to see work
like this going on.

I've got only a few general comments at this point.

> 1. The surface backend interface is not very flexible and doesn't fit
> many of the output devices that we like to support. Hence, supporting
> higher level output devices like PS, PDF and SVG in a good way, is not
> possible through the current backend system and would require backends
> to be able plug in at a different level and that would make things more
> complicated.

That's true to some extent. But the new proposal also may not be
adequate for some things I would like to see in a high-level
backend. For example, I think it would be great to have a "save as SVG"
as a common operation on any window. And then I'd like to get SVG out
that is editabled, (ie. with paths as paths).

This is a very different scenario than generating PDF or PS for printing
which involves a tessellator/rasterizer that we don't control. In that
case, there are situations where we will want to push to a low level to
guarantee high quality even with buggy rasterizers.

So, it may end up that we actually will want two different ways to get
output out to things like PDF/PS/SVG.

> 3. Clipping is inflexible and the way it's done right now is not
> efficient for all backends.

This is clearly a problem, but I think it should be pretty easy to fix
without a major re-working of the whole interface. For example, just
switching to a trapezoid-based interface rather than surface-based would
help a lot, right?

I can't yet comment much on your specific proposals[*], but my general
advice would be to approach this one step at a time, and focus on things
that solve problems we've already run into more than things for problems
we may hit later.

Thanks again.


[*] In two weeks I am planning to have a lot more time to focus on
cairo. I'm looking forward to that very much.

More information about the cairo mailing list