Re: picture slide show flicker and previous image flush problem

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

 



2011/5/11 Jerry Wang <jerry.wang@xxxxxxxxxx>:
> Hi guys,
>
> I wrote some code with GTK lib to show the image consequently and here
> is my situation.
>
> Â Â Â Âuse pixbuf to get data from files:
> Â Â Â Â-pixbuf=gdk_pixbuf_new_from_file(filename, NULL);
>
> Â Â Â Âuse pixmap to get the mask (for transparent consideration):
> Â Â Â Â-mask=gdk_pixmap_new(NULL, width, height, 1);
> Â Â Â Â-gdk_pixbuf_render_threshold_alpha(pixbuf, mask, 0, 0,
> Â Â Â Â0, 0, width, height, 1)
>
> Â Â Â Âthen combine the mask with shown window:
> Â Â Â Âgdk_window_shape_combine_mask(window->window, mask, 0, 0);
>
> Â Â Â Âand crate the image from pixbuf:
> Â Â Â Â-image=gtk_image_new_from_pixbuf(pixbuf);
>
> Â Â Â Âthen add to window:
> Â Â Â Âgtk_container_add((GtkContainer*)window, image);
>
>
> Â Â Â Âbefore every image loading, remove the old one
> Â Â Â Âgtk_container_remove((GtkContainer*)window, image);
>
> My images are around 2M high definition PNG files. And my running
> machine is a ATOM N270 1.6G. Every image will take about 0.3s to load.
>
> My problem is, there are one totally transparent image in my image
> files. After showing the total transparent image, before pop out the
> next image, it will show the previous image (before the transparent
> image) for a very short of time, just like flushing the buffer.

I'm not sure it is the cause of the problem, but using adding a new
widget to the hierarchy for every image seems like a wrong approach. A
better way would be to use Cairo to draw the pixbufs directly in the
draw event of a widget, for example a GtkDrawingArea.

This would require some rewriting of the code, but you gain a lot of
flexibility, like e.g. the possibility for crossfading. Make sure you
don't actually load the pixbuf in the draw(expose) event, but only do
the gdk_cairo_set_source_pixbuf(), cairo_paint() there.

> I was considering the root cause is double buffering. But if I disable
> the double buffering feature, the slide show will not be smooth, it
> looks flick.
>
> Also I try to disable the X's double buffer extension, but still see
> previous image.
>
> Need advice.
>
> Thanks,
> Jerry

Maarten
_______________________________________________
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