Trying to create pixmap



Hi,

I'm trying to read a bitmap into a pixmap, but I'm having no
luck. Could someone explain why the following code won't work?

It gives:

	** ERROR **: BadMatch (invalid parameter attributes)
	Abort  

The code:

#include <gtk/gtk.h>

#define eye_width 21
#define eye_height 21
static unsigned char eye_bits[] = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x80, 0x3f, 0x00, 0xe0, 0xff, 0x00, 0xf8, 0xff, 0x03, 0xfc, 0xff, 0x07,
  0x9e, 0x37, 0x0f, 0xcf, 0x7f, 0x1c, 0xc3, 0x7f, 0x10, 0xc3, 0x7f, 0x18,
  0x8e, 0x3f, 0x0c, 0x9c, 0x3f, 0x07, 0x78, 0xdf, 0x03, 0xe0, 0xff, 0x00,
  0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00 };

int
main(int argc, char **argv)
{
    GtkWidget *win, *px;
    GdkPixmap *pixmap;

    gtk_init(&argc, &argv);
    win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    pixmap = gdk_bitmap_create_from_data(win->window, (gchar *)eye_bits,
					 eye_width, eye_height);
    px = gtk_pixmap_new(pixmap, pixmap, pixmap, pixmap, pixmap);
    gtk_container_add(GTK_CONTAINER(win), px);
    gtk_widget_show(px);
    gtk_widget_show(win);
    
    gtk_main();

    return(0);
} /* main() */
    



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