Replace pixmap
- From: Flávio Alberto Lopes Soares <engenharia3 maqplas com br>
- To: gtk-list gnome org
- Subject: Replace pixmap
- Date: 10 Dec 2001 11:49:22 -0200
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.
This is the code troca_pixmap :
int
troca_pixmap(gpointer user_data, char *nome_pixmap, char *filename)
{
GtkWidget *pixmap;
GdkColormap *colormap;
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
gchar *pathname;
pixmap = lookup_widget(user_data, nome_pixmap);
if (!filename || !filename[0])
return -1;
pathname = gnome_pixmap_file (filename);
if (!pathname)
{
g_warning (_("Couldn't find pixmap file: %s"), filename);
return -1;
}
colormap = gtk_widget_get_colormap (user_data);
/* gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap,
&mask, NULL, pathname); */
gdkpixmap = gdk_pixmap_create_from_xpm (NULL, &mask, NULL, pathname);
if (gdkpixmap == NULL)
{
g_warning (_("Couldn't create pixmap from file: %s"), pathname);
g_free (pathname);
return -1;
}
g_free (pathname);
gtk_pixmap_set(GTK_PIXMAP(pixmap), gdkpixmap, mask);
gdk_pixmap_unref (gdkpixmap);
gdk_bitmap_unref (mask);
return 1;
}
Thanks for any help.
Flavio Alberto
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]