Re: cairocffi and GDK-PixBuf for decoding JPEG and other image formats
Simon Sapin <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
Le 26/02/2013 15:33, Dominic Lachowicz a écrit : > Hi Simon, > > FYI - GdkPixbuf has an equivalent function (set_source_pixbuf) that > can do this too. > > http://www.pygtk.org/docs/pygtk/class-gdkcairocontext.html#method-gdkcairocontext--set-source-pixbuf This function is not actually part of GDK-PixBuf (which can be installed independently of GTK, these days.) cairocffi uses when available, but has fallback methods otherwise. (I don’t really like installing all of GTK on servers.) Even with set_source_pixbuf, when all you want is an ImageSurface for the image you need to create a temporary surface, a temporary context, call set_source_pixbuf, then get_source to get a surface pattern and then get_surface to get the surface. Oh, and by the way, get_surface is buggy (segfaults) in this case with old py2cairo versions. cairocffi hides all of this away in a simple function. -- Simon Sapin -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo