[cairo] Cairo API is all shook up (was: API Shakeup: cairo_create
and eliminating cairo_set_target_surface)
cworth at cworth.org
Wed Jul 6 11:58:05 PDT 2005
On Tue, 10 May 2005 09:57:10 +1200, Robert O'Callahan wrote:
> I'd be happy with either a new "/dev/null" surface type, or the ability
> to create a cairo_t with no target surface. I'd slightly prefer the
> latter. I'd prefer a dedicated API function rather than
> cairo_create(NULL). "cairo_create_no_target()"?
Keith and I were talking about this in some depth last night. Here's
what we came up with:
1) Any user of the non-toy text APIs, (eg. cairo-ft.h), can create a
cairo_font_face_t, a cairo_scaled_font_t, and compute font and
glyph extents without ever needing a cairo_t. So that use case is
2) The toy API, (cairo_select_font_face), really does require a target
surface so that it knows what backend is being targeted. It has to
know this so that it has the ability to query backend-specific
properties, (eg. subpixel ordering), in order to be able to create
its own fonts.
This means that it wouldn't make sense to have a way to create a
cairo_font_face_t from family/weight/slant without requiring a
cairo_t. And it wouldn't make sense to support a NULL surface in
cairo_create or a non-targeted cairo_t.
Instead, users who find themselves wanting cairo_create(NULL)
should just create a dummy surface in order to communicate what
backend will be targeted. For the xlib backend, this can be done
quite easily by creating a surface for the Root window. For things
like the image backend, it's only a little bit harder to make a 1x1
Does that make sense? Anything we missed?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050706/1841ce7a/attachment.pgp
More information about the cairo