Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async Gdk.Pixbuf pix_from_data (uint8[] data){
- FileIOStream stream;
- var file = File.new_tmp ("totoXXXXXX", out stream);
- stream.output_stream.write (data);
- stream.seek (0,SeekType.SET);
- Gdk.Pixbuf? pix = null;
- if(data.length > 0)
- pix = yield new Gdk.Pixbuf.from_stream_async (stream.input_stream, null);
- else
- pix = new Gtk.Image.from_icon_name ("image-missing",Gtk.IconSize.MENU).pixbuf;
- return pix;
- }
- /***/
- Gtk.Image imgTag = ...
- uint8[] buffer = ...
- /***/
- pix_from_data.begin (buffer,(obj,res)=>{
- try {
- imgTag.pixbuf = pix_from_data.end(res);
- }catch(GLib.Error e){
- print("%s\n",e.message);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement