Re: CairoIO - Cairo compatible successor to GdkPixbuf

On Fri, 16 Nov 2007 14:04:45 +0100, "=?ISO-8859-1?Q?BJ=F6rn_Lindqvist?=" wrote:
>     surface = cairoio.load('foobar.png')
>     if surface.get_format() in (cairo.FORMAT_ARGB32,):
> is equivalent with:
>     pixbuf = gdk.pixbuf_new_from_file('foobar.png')
>     if pixbuf.get_has_alpha():

Actually, better cairo code would be:

	if surface.get_content() == cairo.CONTENT_COLOR_ALPHA:

> Cairo currently only supports one alpha format which is FORMAT_ARGB32
> (FORMAT_A8 and FORMAT_A1 doesn't count), but might support more in
> the future.

The code I presented will be robust against future additions of
color-and-alpha-supporting image formats.

Another thought that occurs to me is that you should think about how
to support fast loading of image data directly into cairo surfaces
other than cairo-image surfaces, (for example a cairo-xlib surface).

There's been recent discussion on the cairo mailing list about adding
API to support this well, (for example, allowing XShm transport), and
it might be very nice if you could provide some feedback on that. Let
me know if you need a specific pointer to the thread(s).


Attachment: pgpBDqUjgTMEH.pgp
Description: PGP signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]