mattn / go-gtk

Go binding for GTK
http://mattn.github.com/go-gtk
BSD 3-Clause "New" or "Revised" License
2.12k stars 246 forks source link

GInputStream (or gdkpixbuf + load images from memory) #173

Open raichu opened 11 years ago

raichu commented 11 years ago

According to the docs, there's gdk_pixbuf_new_from_stream but it requires GInputStream. Would it be too difficult to handle?

mattn commented 11 years ago

GTK3 ?

raichu commented 11 years ago

I think it's GTK2.

raichu commented 11 years ago

I checked and GInputStream seems to be a part of glib2 and gdk_pixbuf_new_from_stream is a part of gdkpixpuf2. Both can be seen in pre-gtk3 sources.

raichu commented 11 years ago

I realized that it's not really necessary for loading images from memory.: I got the job done using gdkpixbuf.Loader :)

Just one caveat, the Write function isn't compatible with usual Write function of Go (io.Writer) so I couldn't use io.Copy etc. How about making it return (n int, err error)? n can be 0 or the input size depending on the error.