Re: GdkGC question



Tom Aziz <tomazi caramail com> writes:
I don't succed to draw lines of different colors (and 
style).
I need some help but it seems that nobody uses GDK drawing 
features, and that there is no tutorial about this. It's 
very sad because I want to use GDK for this, but if I can't 
I will have to use another lib or another programming 
langage with more documentation.

See the "scribble" example in the tutorial, and reference material in
the GDK chapter of http://developer.gnome.org/doc/GGAD/

void
drawing_init(GtkWidget *widget, gpointer data)
{
 lines1_GC = gdk_gc_new(widget->window);
 lines2_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);


here you have to allocate the color, using 
gdk_colormap_alloc_color (gtk_widget_get_colormap (widget), color1)

 gdk_gc_set_foreground(lines1_GC, color1);
/* same with color2 and lines2 */
}

For line styles, you can change width and dashes and join style, etc.,
covered in doc/GGAD/

Havoc




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