[Gtk-sharp-list] How to make pixbuf from cairo surface

Nicholas Frechette zeno490 at gmail.com
Sat Mar 31 18:05:18 UTC 2012

I'm not sure about drawing to a pixbuf but here is what I use to draw
to a pixmap:

private Cairo.Surface mCompositeSurface;
private Pixmap mCompositePixmap;

private void HandleDrawingAreaConfigureEvent(object o, ConfigureEventArgs args)
    var lAllocation = mDrawingArea.Allocation;
    mCompositePixmap = new Pixmap(args.Event.Window,
lAllocation.Width, lAllocation.Height, -1);
    mCompositeSurface = new Cairo.ImageSurface(Cairo.Format.ARGB32,
lAllocation.Width, lAllocation.Height);
    // Draw to surface here
    var lPixmapContext = CairoHelper.Create(mCompositePixmap);
    lPixmapContext.SetSourceSurface(mCompositeSurface, 0, 0);

Hope this helps.

On Wed, Mar 28, 2012 at 9:12 PM, Dobromir Enchev <blez at abv.bg> wrote:
>  I tried to find a way, but it seems that gdk_pixbuf_get_from_surface isn't
> ported to Gtk#.
>  How can I accomplish this?
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

More information about the Gtk-sharp-list mailing list