Re: Hi



Zbigniew Wasik wrote:

Already 4:33AM but I almost finished my small project (showing pictures)
and do some drawings <- jut for me - to learn GTK / GDK

Only one problem - How I can draw e.g. RED rectangles on drawingarea I tried with GdkColor and GC but I all the time I get black rectangles.

Also how to make double buffering for showing images and drawing lines
on those images
Hello,
As for black rectangles - you should allocate color before use it in gdk_gc_set_[fore][back]ground():
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-color
you will see strange results with unallocated color because GdkColor::pixel value is not initialized.

Widgets in GTK2 are double-buffered by default, it can be turn off for particular widget with gtk_widget_set_double_buffered():
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-set-double-buffered
Also you can check whether widget is double buffered or not with GTK_WIDGET_DOUBLE_BUFFERED() macro:
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GTK-WIDGET-DOUBLE-BUFFERED-CAPS

   Olexiy




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