I looked around for a way to load a png into Cairo using Mono (C#) binding of the library but the closest I got was that in C-binding of the library something like cairo_image_surface_create_from_png() was used. However, in C#-binding of the library I didn't see any useful static members under Cairo.ImageSurface.*. Somewhere an old article mentioned that the binding is incomplete, is this the case? Currently I'm using Gdk.Image.Pixbuf to load in-memory (embedded) images but saw that Gtk+ have moved on to Cairo and that Windows.Forms in Mono are using Cairo, I thought the Cairo's C#-binding would at least be completed enough to include image loading. I'm probably missing something?

Thanks. I looked at the constructors for ImageSurface class and they seem to offer creating surfaces from byte[] as my png is embedded as a resource (and read off like a stream object). I'll try it next, but the constructor appear to need width/height which should be in png's metadata, I suspect it may not work like your filesystem based parsing of png. Other then looping through filesystem, is there another way of getting embedded png into a cairo surface without first parsing it through gdk or the likes? e.g. directly via cairo, or as clean as possible?
–
BillJan 16 '12 at 10:35

@Bill, not as far as I know. You could probably find the dimensions of the png from the resource stream though.
–
IanNortonJan 16 '12 at 11:11