[Gtk-sharp-list] ImageSurface to Pixbuf?

Doug Blank doug.blank at gmail.com
Fri Feb 21 08:13:09 UTC 2014


Attempting to create a Pixbuf from an ImageSurface, but all I get is a back
square. Any ideas?

Cairo.ImageSurface surface = mysurface;
int w = surface.Width;
int h = surface.Height;
Gdk.Pixmap pixmap = new Gdk.Pixmap(null, w, h, 24);
using (Cairo.Context cr = Gdk.CairoHelper.Create(pixmap)) {
  cr.Operator = Cairo.Operator.Source;
  cr.SetSource(surface);
  cr.Paint();
}
_pixbuf = Gdk.Pixbuf.FromDrawable(pixmap, Gdk.Colormap.System, 0, 0, 0, 0,
w, h);

-Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20140221/f6223f68/attachment.html>


More information about the Gtk-sharp-list mailing list