-
归档
- 2012 年三月
- 2011 年九月
- 2011 年二月
- 2011 年一月
- 2010 年十二月
- 2010 年十一月
- 2010 年八月
- 2010 年七月
- 2010 年六月
- 2010 年五月
- 2010 年四月
- 2010 年三月
- 2010 年二月
- 2010 年一月
- 2009 年十二月
- 2009 年十一月
- 2009 年十月
- 2009 年九月
- 2009 年八月
- 2009 年七月
- 2009 年六月
- 2009 年五月
- 2009 年三月
- 2009 年二月
- 2009 年一月
- 2008 年十二月
- 2008 年十一月
- 2008 年十月
- 2008 年九月
- 2008 年八月
- 2008 年七月
- 2008 年六月
- 2008 年五月
- 2008 年四月
- 2008 年三月
- 2008 年二月
- 2008 年一月
- 2007 年十二月
- 2007 年十一月
- 2007 年十月
- 2007 年九月
- 2007 年八月
- 2007 年七月
- 2007 年六月
- 2007 年五月
- 2007 年四月
- 2007 年三月
- 2007 年二月
- 2007 年一月
- 2006 年十二月
- 2006 年十一月
- 2006 年十月
- 2006 年九月
- 2006 年八月
- 2006 年七月
- 2006 年六月
- 2006 年五月
- 2006 年四月
- 2006 年三月
- 2006 年二月
- 2006 年一月
- 2005 年十二月
- 2005 年十一月
- 2005 年十月
- 2005 年九月
- 2005 年八月
- 2005 年七月
- 2005 年六月
- 2005 年二月
- 2004 年十月
- 2004 年九月
- 2004 年八月
-
杂项
日归档:2009 十一月-18
[GTK编程]如何读取网络中的图片创建image控件
发个牢骚,五千万个干!昨天可是想破头了,今天起来翻翻文档就实现了。代码相当的ugly,希望有高手赐教更方便的方法,实现方法很简单就是通过curl访问读取到内存中,然后调用gdk_pixbuf_new_from_stream,最后通过gtk_image_new_from_pixbuf创建。 /*功能:演示在GTK中如何读取网络中的图片创建image控件编译:gcc -Wall -g `pkg-config –cflags –libs gtk+-2.0` pixbuf.c -o pixbuf作者:SuPanYong@Gmail.com主页:http://www.spy8888.com*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <gtk/gtk.h>#include <curl/curl.h>#include <curl/types.h>#include <curl/easy.h>#include <gio/gio.h> struct MemoryStruct { char *memory; size_t size;}; /* 代码出处http://curl.haxx.se/libcurl/c/getinmemory.html */static void *myrealloc(void *ptr, size_t size){ if(ptr) return realloc(ptr, size); else return malloc(size);} static size_tWriteMemoryCallback(void *ptr, size_t … 继续阅读