从GTK网上显示的图像 [英] display a image from the internet in gtk
问题描述
我想从互联网上显示的图像
我怎么可以把它?
I wanna display a image from the internet how can I put it?
推荐答案
GTK +不读取来自互联网,你将不得不自己做的那部分。文件
GTK+ doesn't read files from the Internet, you're going to have to do that part yourself.
一旦你有一个已知的格式在内存中的像素数据(如JPEG或PNG),调用 <一个href=\"http://library.gnome.org/devel/gdk-pixbuf/stable/gdk-pixbuf-file-loading.html#gdk-pixbuf-new-from-stream\"相对=nofollow> gdk_pixbuf_new_from_stream()
(设置在内存中的数据流后)来加载它。
Once you have the pixel data in memory in a known format (such as JPEG or PNG), call gdk_pixbuf_new_from_stream()
(after setting up an in-memory stream) to load it.
然后手说的pixbuf到的 gtk_image_new_from_pixbuf()
,您GtkImage添加到GtkWindow继承,调用的 gtk_widget_show_all()
在窗口上,你应该做的。
Then hand that pixbuf to gtk_image_new_from_pixbuf()
, add your GtkImage to a GtkWindow, call gtk_widget_show_all()
on the window, and you should be done.
这篇关于从GTK网上显示的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!