[cairo] How to output images from data originating from files?
Ken Resander
kresander at yahoo.com
Fri Apr 5 07:03:46 PDT 2013
I am new to Cairo and have fairly limited knowlege of graphics (Windows GDI,GDI+ years ago).
I am now on Ubuntu 12.04 and need to render images in png and jpg from GTK in C/C++.
I know how to do this when specifying .png and .jpg file names:
cairo_surface_t * imgpng = cairo_image_surface_create_from_png("sample_7.png");
cairo_set_source_surface(cr, imgpng, 0,40);
cairo_paint(cr);
GError * err = NULL;
GdkPixbuf * imgpxb = gdk_pixbuf_new_from_file("parrots.jpg",&err);
gdk_cairo_set_source_pixbuf(cr, imgpxb, 0, 150);
cairo_paint (cr);
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.
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.
Is there a better way?
Ken
P.S. only png and jpg files will be used
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20130405/d93b3a30/attachment.html>
More information about the cairo
mailing list