PS/PDF API Change Proposal: (Re: [cairo] Semantics of transparent objects)

Carl Worth cworth at cworth.org
Wed Jan 18 12:43:00 PST 2006


On Wed, 18 Jan 2006 12:22:18 -0800, Keith Packard wrote:
> 
> I'm just trying to keep surface attributes associated with the surface
> and drawing attributes associated with the rendering context. Size,
> orientation and other things seem like surface attributes to me, not
> rendering context.

OK. I'll buy that. These attributes are largely irrelevant for doing
any drawing, (particularly if the application uses the matrix to
normalize away the surface size or so).

> > How is that fundamentally "better" than the following?
> 
> It's not, and your code is shorter.

Well, I did cheat by leaking the cairo_t with a missing
cairo_destroy. But yeah, I do prefer to pass cairo_t* to a drawing
function rather than a surface, (and there is a saved
cairo_create/destroy there that's not visible in the examples as we
typed them).

>                                       Passing the surface to
> set_page_options would make them functionally equivalent.

Yes. That looks good to me.

>                                                           Note that some
> libraries encourage transient cairo_t creation (like Gtk+), so keeping
> persistant information in the surface might be a better way ot
> respecting that design.

I think I'm convinced.

And now I feel really foolish, since I notice that it was exactly
cairo_surface_set_document_properties that I had originally proposed
at the GNOME summit. (Though in light of the current discussion,
set_page_properties might be better, or maybe we provide both of those
separately).

So at least at some point in the past it was quite obvious to me that
these attributes are surface attributes.

I think what tripped me up was the recent realization of the timing
requirements for setting these attributes. It seems clear that the
nature of some of the backends and some of these attributes is such
that they must be set before any rendering occurs on a given page. So
the timing of the new call is related to cairo_show_page, and I think
it was that correspondence that made me start thinking this new call
should be a cairo_t* call like cairo_show_page.

But, we've got a recommended main loop now that looks just fine to me,
and will satisfy the timing requirements just fine.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060118/924f71d3/attachment.pgp


More information about the cairo mailing list