[Newbie] Despairence about Graphics Context.



Greetings,

I'm new to gtk, so please don't blame me.

I'm trying to paint a green square in an offscreen pixmap. My current  
approach is:

GdkColor green; //Formulas
GdkGC gc;
GtkWidget *widget;
Pixmap *pixmap;
GdkColormap *map;
GdkColor color_green;

map = gdk_colormap_get_system(); // Get the System's colormap
gdk_color_parse("green",&color_green); //Get the color
gdk_colormap_alloc_color(map,&color_green); //Allocate it
gdk_draw_rectangle(pixmap,widget -> style -> black_gc,TRUE,30,30,20,20); 
//Works fine.
gdk_gc_copy(&gc, widget -> style -> white_gc); //Causes a segmentation fault; 
get the new context

gdk_gc_set_foreground(&gc, &color_green); //Set the color


gdk_draw_rectangle(pixmap,&gc,TRUE,1,1,20,20); //Draw the rectangle

What's wrong here?

Keep smiling
yanosz

-- 
GnuPG Key available at http://www.jluehr.de.vu/public_key.asc



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