[cairo] surfaces and backends
Owen Taylor
otaylor at redhat.com
Wed Mar 16 08:15:53 PST 2005
On Thu, 2005-03-17 at 00:00 +0800, Steve Chaplin wrote:
> I'd like to implement some new surface methods for pycairo
> surface.set_size()
> surface.set_device_offset()
>
> They're available for the xlib backend, but not other backends, so I would
> need to check that the surface is an xlib surface.
> Does Cairo provide a direct way to ask a surface which backend it was created for?
> Or is that something a language binding should handle itself (if needed) using
> cairo_surface_set_user_data()?
I think the right way to handle this is in python is with a subclass,
and you have to be able to determine the right subclass on calls like
cairo_get_target_surface()
How do we identify surface types?
1. Strings. cairo_surface_get_backend_name()
2. Boolean predicate. cairo_surface_is_xlib()
3. Opaque type object
cairo_type_t *cairo_surface_get_type()
cairo_type_t *cairo_xlib_surface_type()
4. Global #defines
#define CAIRO_TYPE_XLIB_SURFACE 1
Not clear to me what's right. Having to reinvent this is the
not-using-GObject penalty.... :-)
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/70b97e20/attachment.pgp
More information about the cairo
mailing list