Re: picture slide show flicker and previous image flush problem
- From: Maarten Bosmans <mkbosmans gmail com>
- To: Jerry Wang <jerry wang beonic com>
- Cc: "gtk-list gnome org" <gtk-list gnome org>
- Subject: Re: picture slide show flicker and previous image flush problem
- Date: Thu, 12 May 2011 11:21:47 +0200
2011/5/12 Jerry Wang <jerry wang beonic com>:
> I'm wondering if the cario is the right solution.
>
> Because there are window transparency based on image transparency. I
> played a looped movie indefinitely in the X root window. And I need to
> paint a picture on it, like logo.
I was conveniently ignoring the whole window transparency issue,
because I have no experience with that ;-)
Wouldn't it be better to just play the movie in a window and also
drawing the overlay in that window?
> I still need to mask the image window background, right?
Try to only change the mask to the windows to the picture
transparency, while keeping the image widget the same. Does that show
the flicker too?
Maarten
> Jerry
>
> On Wed, 2011-05-11 at 18:22 +1000, Maarten Bosmans wrote:
>> 2011/5/11 Jerry Wang <jerry wang beonic com>:
>> > 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
>
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]