[cairo] cairo_xlib_surface_create_for_pixmap ()

Owen Taylor otaylor at redhat.com
Wed Mar 16 07:22:13 PST 2005


On Wed, 2005-03-16 at 16:26 +0800, Steve Chaplin wrote:
> The format argument for cairo_xlib_surface_create_for_pixmap () says
> "format : a standard Cairo pixel data format. The depth (number of of bits
>  used) for the format must match the depth of pixmap."
> 
> Why not use gdk_drawable_get_depth() to read the depth of of the pixmap 
> and use it to set format, and remove the format argument? It would prevent
> any depth mismatch errors.

gdk_drawable_depth() is using information internally cached in GTK+ from
the Pixmap creation. At the Xlib level, there is no way to get the depth
of a pixmap without a roundtrip to the server.

> Also, shouldn't the return value be
> "Returns : the newly created surface or NULL"?

See comment in the last mail about error objects; the plan is to return
an error object also for object creation so Cairo code isn't full of
stuff like:

 pattern = cairo_pattern_create_linear ();
 if (!pattern)
     return;

It's not *completely* clear to me that the same approach will work for
surfaces. For example, making cairo_image_surface_create() never return
%NULL means that if we add a cairo_image_surface_get_data() function,
that *could* return %NULL. 

But I think that is going to wait until someone steps up and implements
the error object scheme. We'll have to see how it works out in practice.

Regards,
					Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050316/db12d2ee/attachment.pgp


More information about the cairo mailing list