Re: GdkPixbufLoader size-prepared troubles



On Tue, 2010-08-10 at 17:29 +0900, Alesh Slovak wrote:
> Hello,
> 
> Regarding GdkPixbufLoader's size-prepared signal, the documentation claims: 
> "This signal is emitted when the pixbuf loader has been fed the initial amount 
> of data that is required to figure out the size of the image that it will create."
> 
> Which, to me, seems to imply that the signal is emitted only once. However, I am 
> receiving it almost as frequently as the area-updated signal.

Bluefish uses the size-prepared signal to scale images while they are
being written. The size-prepared signal is only emitted one.
> 
<snip...>
> 
> Furthermore, the documentation states:
> "Applications can call gdk_pixbuf_loader_set_size() in response to this signal 
> to set the desired size to which the image should be scaled."
> 
> But when I do this, the image data never makes it into the pixbuf, although the 
> pixbuf itself appears to get sized correctly.

Are you trying to get the pixbuf from the loader too soon?

> 
> For the record, I am using gtkmm 2.4 on Debian testing and attempting to load 
> PNM data. I didn't get the feeling that this was a gtkmm specific issue, but I 
> could be wrong.

I tried loading an PNM image in Bluefish's image dialog and it loaded
correctly. Might try looking at the Bluefish code. However, it is
written in C.

http://bluefish.svn.sourceforge.net/viewvc/bluefish/trunk/bluefish/src/plugin_htmlbar/image_dialog.c?revision=5965&view=markup

The pixbuf loader is created in image_dialog_set_preview(). The
size-prepared signal is connected here. The image data is then read
async. The read status is returned to image_dialog_load_preview(). If
the image was successfully read, the code under OPENFILE_FINISHED is
executed. This calls gdk_pixbuf_loader_write(). The size-prepared signal
handler is called to scale the image, pbloader_size_prepared(). If the
calls to gdk_pixbuf_loader_write() and gdk_pixbuf_loader_close() return
successfully, then the pixbuf is read with
gdk_pixbuf_loader_get_pixbuf().


Regards,
	Jim H





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]