trying to combine pixmaps
- From: Travis Loyd <lelandg usa net>
- To: gtk-list redhat com
- Subject: trying to combine pixmaps
- Date: Wed, 9 Sep 1998 15:34:51 -0500 (CDT)
Without a good understanding of masks or gdk I've been able to combine 2
pixmaps but can't add any more to the result. Also in this code I get
warnings about gc not equalling null ... don't know what that is about
either. 3) If I add a variable GdkBitmap *mask3; after mask2 the resulting
picture is different....... overflowing somewhere.
Main question: I need to add a few xpms to one origional xpm which is
simply a solid color.
If there are really obvious problems help would be very very much
appreciated!
Travis Loyd
[email: lelandg@usa.net ]
[other: s201635@mail.nwmissouri.edu ]
[ pgp: send email with subject: sendmepgp ]
------CUT HERE-----------------------------------------------------------
#include <gtk/gtk.h>
#include "default0.xpm"
#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);
gtk_widget_realize(window);
// 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], default0_xpm);
gdk_pixmap1 = gdk_pixmap_create_from_xpm_d(
window->window, &mask2,
&style->bg[GTK_STATE_NORMAL], wall_e_xpm);
/* Combine 2 images here */
gdk_draw_pixmap(gdk_pixmap1, NULL, gdk_pixmap2, 0, 0, 0, 0, 40, 40);
/* Load up another image to add to the same image */
//*************************** RIGHT HERE ******************************
// gdk_pixmap1 = gdk_pixmap_create_from_xpm_d(
// window->window, &mask2,
// &style->bg[GTK_STATE_NORMAL], default1_xpm);
//
// gdk_draw_pixmap(gdk_pixmap2, NULL, gdk_pixmap1, 0, 0, 0, 0, 40, 40);
/* Put image to a pixmap */
pixmap1 = gtk_pixmap_new(gdk_pixmap1, mask1);
gtk_widget_show(pixmap1);
gtk_container_add(GTK_CONTAINER(window), pixmap1);
gtk_widget_show(window);
gtk_main();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]