Re: GdkPixbufLoader size-prepared troubles

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

 



On Wed, 2010-08-11 at 16:13 +0900, Alesh Slovak wrote:

> >> 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?
> 
> This appears to be the case. I was getting the pixbuf from the loader in the 
> handler for the area-prepared signal, which worked just fine as long as I didn't 
> call gdk_pixbuf_loader_set_size() in the size-prepared handler.

Quoting from the docs, "area_prepared", will be called as soon as the
pixbuf of the desired has been allocated. You can obtain it by calling
gdk_pixbuf_loader_get_pixbuf(). If you want to use it, simply ref it. In
addition, no actual information will be passed in yet".

>From that I would expect that no image data is written until
area-updated is called. I wouldn't expect a call to
gdk_pixbuf_loader_get_pixbuf() to produce a displayable image in
area-prepared.

> Getting the pixbuf in the area-updated handler fixes this particular problem. So 
> now I can get a scaled image out of the pixbuf loader. I am still receiving 
> multiple size-prepared signals, but it doesn't seem to be having any ill effects 
> as far as I can tell.

I still find it strange that you are seeing multiple size-prepared
signals. I've only ever seen it emitted once and from the docs I would
only expect to see it once.

Are you making multiple calls to gdk_pixbuf_loader_write()? I've never
tried it. but according to the docs...

"This will cause a pixbuf loader to parse the next count bytes of an
image." 

>From that, I wonder if it would be possible to progressively show an
image by making multiple calls to gdk_pixbuf_loader_write() and instead
of passing the full size of image, just pass a specific number of bytes
to parse until the image is fully loaded. Doing this would still allow
using gdk_pixbuf_loader_set_size() to scale the image while it is
loaded. 

> 
> I happened to notice one peculiar thing though, when I call 
> gdk_pixbuf_loader_set_size(), the area-updated signal is only ever called once, 
> after the image has finished loading. Thus, I can't update the display to show 
> the image loading progressively. I guess loading/displaying image data 
> progressively and scaling at the same time are not supported by GdkPixbufLoader?

I've never tried to progressively load the image. Your seeing only one
area-updated signal does make it sound like progressively loading and
scaling the image with gdk_pixbuf_loader_set_size() is not supported.


Regards,
	Jim H

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux