Drawing area color weirdness help?
- From: "Andrew P. Lentvorski" <andrewl deliverator io com>
- To: gtk-list redhat com
- Subject: Drawing area color weirdness help?
- Date: Sun, 10 Jan 1999 00:33:33 -0600
Okay, I created a set of widgets and packed everything together.
One of the widgets is a GtlDrawingArea. Fine. I attach the expose
event to the callback function at the bottom of this message.
Everything comes up fine. It even creates a nice red rectangle.
Then I resize the window ... urp ... the color in the GtlDrawingArea
changes to a random color every time I resize it. Yellow .. Green ...
Blue ... you name it. No particular rhyme or reason.
Why?
I'm assuming that I'm doing something wrong, but I have no idea what.
Also, how do you create a GdkColor from an RGB value?
Thanks,
Andy Lentvorski
Expose callback function starts here:
static gint
wave_expose_event(GtkWidget *widget, GdkEventExpose *event)
{
gint width,height;
GdkColor foreground;
GdkGC *mygc;
if (!gdk_color_parse("red",&foreground))
{
fprintf(stderr,"Failed to parse color\n");
}
gdk_window_get_size(widget->window,&width,&height);
if (!(mygc = gdk_gc_new(widget->window)))
{
fprintf(stderr,"Failed to allocate GC\n");
}
gdk_gc_set_foreground(mygc,&foreground);
gdk_draw_rectangle(widget->window,
mygc,
TRUE,
0,0,
width,height);
gdk_gc_destroy(mygc);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]