Gdk/color question
- From: Pascal (Tomazi) <tomazi caramail com>
- To: gtk-app-devel-list gnome org
- Subject: Gdk/color question
- Date: Fri, 30 Mar 2001 16:54:09 GMT+1
I don't know how to draw lines of different colors (and
style).
Here is what I do :
--- global variable ---
static GdkGC *lines1_GC = NULL;
-----------------------
--- main() ---
gtk_signal_connect(GTK_OBJECT(MainDrawingArea),
"configure_event",
GTK_SIGNAL_FUNC(drawing_init), NULL);
--------------
--- drawing_init ---
void
drawing_init(GtkWidget *widget, gpointer data)
{
GdkColor *color1;
lines1_GC = gdk_gc_new(widget->window);
color1 = g_new(GdkColor, 1);
color1->red = (gushort)(65535 * 1.00);
color1->green = (gushort)(65535 * 0.50);
color1->blue = (gushort)(65535 * 0.50);
gdk_gc_set_foreground(lines1_GC, color1);
/* ... */
}
--------------------
when an event (click) occurs, I use this function to draw
the line :
--- gdk_draw_line ---
gdk_draw_line(pixmap, lines1_GC,
x1, y1,
x2, y2);
---------------------
The problem is : no matter what color I choose in
drawing_init, I get only the black
color. All of the code is in the same file.
Thanks for any help
Tomazi
______________________________________________________
Boîte aux lettres - Caramail - http://www.caramail.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]