<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>I am new to Cairo and have fairly limited knowlege of graphics (Windows GDI,GDI+ years ago). <br>I am now on Ubuntu 12.04 and need to render images in png and jpg from GTK in C/C++.<br><br>I know how to do this when specifying .png and .jpg file names:<br><br>cairo_surface_t * imgpng = cairo_image_surface_create_from_png("sample_7.png");<br>cairo_set_source_surface(cr, imgpng, 0,40);<br>cairo_paint(cr);<br><br>GError * err = NULL;<br>GdkPixbuf * imgpxb = gdk_pixbuf_new_from_file("parrots.jpg",&err);<br>gdk_cairo_set_source_pixbuf(cr, imgpxb, 0, 150);<br>cairo_paint (cr);<br><br>My program will receive image data from another computer via standard protocols. There might be hundreds of small to small-medium images coming, so it would more efficient to batch the file content of these into a huge buffer and pass that across
 (from the other computer) along with the image format, buffer offset and length of each chunk.<br><br>Of course I could copy a chunk into a tmp file and use the png surface and gdkpixbuf filename api calls above, but it seems such a shame having to put the data back into a file for cairo/gdk to read and convert it to the format needed.<br><br>Is there a better way?<br><br>Ken<br>P.S. only png and jpg files will be used<br><br></div></div></body></html>