[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
GdkGC Question
- From: Ajit Krishnan <akrishna julian uwo ca>
- To: gtk-app-devel-list redhat com
- Subject: GdkGC Question
- Date: Tue, 10 Aug 1999 11:02:49 -0400
hi,
I'm having a couple of problems with gdk and i wonder if one of you
could help me :-)
I'm double buffering my screen output onto a pixmap first which i've
defined as a GdkDrawable *pixmap and then i have two functions exposeEvent
and configureEvent (just like in the tutorials). the configureEvent draws
onto the pixmap and the exposeEvent draws the pixmap onto the screen.
i'm having a problem with the graphics contexts (i.e. don't really understand
them) i have the pixmap, and would like the background to be grey and the
foreground writing to be black.....so this is what i tried...
here is the important excerpt from
w_configureEvent (GtkWidget *widget, GtkEventConfigure *event) {
GdkColormap *cmap = gdk_colormap_get_system ();
Gdkcolor cblack, cgrey;
GdkGC *gc;
cblack.red = 0;
cblack.green = 0;
cblack.blue = 0;
cgrey.red = 0x9000;
cgrey.green = 0x9000;
cgrey.blue = 0x9000;
if (!gdk_color_alloc (cmap, &cgrey)) g_warning ("problem with red");
if (!gdk_color_alloc (cmap, &cblack)) g_warning ("problem with black");
if (pixmap) gdk_pixmap_unref (pixmap);
pixmap = gdk_pixmap_new (widget->window, widget->allocation.width, widget->allocation.height, -1);
gc = gdk_gc_new (pixmap);
gdk_gc_set_background (gc, &grey);
gdk_gc_set_foreground (gc, &black);
gdk_draw_rectangle (info->amsa_pixmap, gc, TRUE, 0, 0, 300, 300);
.
.
.
Now, i'd expect that i should get a rectangle with a black border and a grey fill colour.
instead i get a solid black rectangle....the funny thing is i get a solid black rectangle
even if i change the background and foreground colours of gc to white...
can someone please tell me what i'm doing wrong?
thanks,
ajit
--
Ajit Krishnan
ajit@home.com
akrishna@julian.uwo.ca
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]