combining two xpm's using gdk_draw_pixmap

I know it is possible to combine two xpms... drawing the colored portions
of an xpm on top of another. In my game I have an xpm of a wall that is at
the north and at the east and a basic xpm that all other xpms should be
applied to. So you would end up with an xpm with ground xpm and two walls.

There is something I just don't know about. If you know what is wrong with
this piece of code or know where I can find a simple example help is

Travis Loyd


#include <gtk/gtk.h>

#include "default1.xpm"
#include "wall_e.xpm"
//#include "wall_n.xpm"

void main(int argc, char *argv[]) {
	GtkWidget *window;
	GtkWidget *pixmap1;
//	GtkWidget *pixmap2;
	GdkPixmap *gdk_pixmap1;
	GdkPixmap *gdk_pixmap2;
	GdkBitmap *mask1;
	GdkBitmap *mask2;
	GtkStyle *style;
	GdkGC *gc;

	gtk_init(&argc, &argv);

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_signal_connect(GTK_OBJECT(window), "delete_event",
			GTK_SIGNAL_FUNC(gtk_exit), NULL);
	gtk_signal_connect(GTK_OBJECT(window), "destroy",
			GTK_SIGNAL_FUNC(gtk_exit), NULL);


//	style = gtk_widget_get_style(window);
//	gc = gdk_gc_new((GdkWindow*)window);
//	gc = style->white_gc;
	gc = NULL;

	gdk_pixmap2 = gdk_pixmap_create_from_xpm_d(
			window->window, &mask1,
			&style->bg[GTK_STATE_NORMAL], default1_xpm);

	gdk_pixmap1 = gdk_pixmap_create_from_xpm_d(
			window->window, &mask2,
			&style->bg[GTK_STATE_NORMAL], wall_e_xpm);

	/* Trying new stuff here */

	gdk_draw_pixmap(gdk_pixmap1, NULL, gdk_pixmap2, 0, 0, 0, 0, 40, 40);

	pixmap1 = gtk_pixmap_new(gdk_pixmap1, mask1);

	/* Done trying... hopefully it worked */


	gtk_container_add(GTK_CONTAINER(window), pixmap1);



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