problem with bitmaps
- From: Robert Wilhelm <robert physiol med tu-muenchen de>
- To: gtk-list redhat com
- Subject: problem with bitmaps
- Date: Wed, 12 Nov 1997 18:04:59 +0100
I cannot get a bitmap displayed in a window.
The test program shows a completely black box
in the upper left corner.
Could somebody point out what I am doing wrong here?
Robert
#include <gtk/gtk.h>
#define bm_width 16
#define bm_height 16
static unsigned char bm_bits[] = {
136,136, /* 1000100010001000 */
17, 17, /* 0001000100010001 */
34, 34, /* 0010001000100010 */
68, 68, /* 0100010001000100 */
136,136, /* 1000100010001000 */
17, 17, /* 0001000100010001 */
34, 34, /* 0010001000100010 */
68, 68, /* 0100010001000100 */
136,136, /* 1000100010001000 */
17, 17, /* 0001000100010001 */
34, 34, /* 0010001000100010 */
68, 68, /* 0100010001000100 */
136,136, /* 1000100010001000 */
17, 17, /* 0001000100010001 */
34, 34, /* 0010001000100010 */
68, 68 /* 0100010001000100 */
};
int main (int argc, char *argv[])
{
GtkWidget *window, *gtk_img;
// GtkTable* board;
GtkWidget* board;
GdkImage *image;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
board = gtk_table_new( 2, 2, TRUE);
image = gdk_image_new_bitmap(gdk_visual_get_system(),
bm_bits,bm_width,bm_height);
gtk_img = gtk_image_new(image, NULL);
gtk_table_attach_defaults(board,gtk_img,0,1,0,1);
gtk_container_add(GTK_CONTAINER(window), board);
gtk_widget_show(gtk_img);
gtk_widget_show(board);
gtk_widget_show (window);
gtk_main ();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]