Could someone that know their way around GTK make pike -x pv work with GTK2?
I could probably do that....
----- Original Message ---- From: "Mirar @ Pike developers forum" 10353@lyskom.lysator.liu.se To: pike-devel@lists.lysator.liu.se Sent: Thu, January 21, 2010 10:15:03 AM Subject: -x pv
Could someone that know their way around GTK make pike -x pv work with GTK2?
----- Original Message ---- From: "Mirar @ Pike developers forum" 10353@lyskom.lysator.liu.se To: pike-devel@lists.lysator.liu.se Sent: Thu, January 21, 2010 10:15:03 AM Subject: -x pv
Could someone that know their way around GTK make pike -x pv work with GTK2?
-----------
So, I'm rewriting pike -x pv to work with GTK2, as requested above, and it is requiring a few updates.
First, because of the flexibility of GDK2.Pixbuf, I'm looking at removing Image.Image from the code. GDK2.Pixbuf can do it all (it appears so far) except for reading from a byte stream (as it is written right now). Because of this, I'm modifying gdkpixbuf.pre to add support for loading an image from a string. I'm testing it right now, then I will commit the change when I'm sure it works.
Well, one of the points with pv is that is uses the image codecs in Pike. If you let GDK decode the image, it will
A) not be able to display pictures supported by Image but not by GDK B) not be useful when developing new codecs for Pike
----- Original Message ---- From: "Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum" 10353@lyskom.lysator.liu.se To: pike-devel@lists.lysator.liu.se Sent: Thu, January 28, 2010 10:05:04 AM Subject: Re: -x pv
Well, one of the points with pv is that is uses the image codecs in Pike. If you let GDK decode the image, it will
A) not be able to display pictures supported by Image but not by GDK B) not be useful when developing new codecs for Pike
---------------
Okay, I can see that. I'll see what I can do.
The problem I'm sort of having so far is that some of the stuff from gtk1 doesn't translate over to gtk2 well, like GdkImage is deprecated. GdkPixbuf is the new thing to use, but I'm not sure that encode colors routines (in gdkimage_from_pikeimage in support.c) is necessary, and if so, it needs to be translated to use GtkImage or GdkPixbuf instead.
I'll do some more research.
Since pv stopped working for me I made my own code, it does this:
void gtk_show_image(Image.Image img) { object win=GTK2.Window(GTK2.WindowToplevel); win->set_size_request(img->xsize(),img->ysize()); object da=GTK2.DrawingArea(); win->add(da); win->show_all(); win->show_now(); GTK2.GdkPixmap px=GTK2.GdkPixmap(img); da->set_background(px); }
I'm not sure if that's optimized at all, but it seems to work for now. It was built on a lot of chancing and looking at stuff using indices and typeof. :)
(I don't know why it can't take an Image.Image directly in the set_background. It'd been nice.)
pike-devel@lists.lysator.liu.se