Re: Replace pixmap



> From: Fl?vio Alberto Lopes Soares <engenharia3 maqplas com br>
>
> Hello all,
>
> I'm developing an application that need replace a pixmap from a pixmap
> widget by another to make the blinking effect, I change few things in
> function create_pixmap() suplied by Glade and I achieved to make this,
> but the performance is bad, I make this function replace the pixmap each
> 400 miliseconds, and aparently works, but sometimes the pixmap seems to
> fail the blinking (it seems a "bad-contact"), this is an ugly efect, I
> dont know what I do make better.

The problem you're experiencing may be due to the gtk+ mainloop not
having enough time to execute your function every 400 ms. There's a
speedup which may help switch the pixmaps in a timely manner.

> This is the code troca_pixmap :

[snip]

>   gdkpixmap = gdk_pixmap_create_from_xpm (NULL, &mask, NULL, pathname);

[snip]

The above line recreates the pixmap every time you call this function.
This requires: 1) reading the pixmap data from disk, 2) creating
a pixmap on the X server, and 3) copying the pixmap data to the X server.
This is all fairly time consuming. If you're only flipping back and forth between
a couple of pixmaps, it'll be much faster if you only create them once
and flip back and forth between the cached data.

Ron Steinke



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