Re: colormaps
- From: Olexiy Avramchenko <olexiy irtech cn ua>
- To: Russell Shaw <rjshaw iprimus com au>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: colormaps
- Date: Thu, 16 Oct 2003 19:26:34 +0300
Russell Shaw wrote:
Hi,
In an expose-event callback of a gtk_drawing_area this always paints
a black region even tho i have it set for white:
gdk_draw_rectangle(widget->window,
background_gc,
TRUE,
event->area.x,
event->area.y,
event->area.width,
event->area.height);
I set up the graphics context as:
background_gc=gdk_gc_new(drawing_area->window);
foreground.red=0;
foreground.green=0;
foreground.blue=0;
background.red=0xffff;
background.green=0xffff;
background.blue=0xffff;
gdk_gc_set_foreground(background_gc,&background);
gdk_gc_set_background(background_gc,&background);
gdk_gc_set_function(background_gc,GDK_COPY);
Would i need to do something with creating a new GdkColormap to make
it work?
You should allocate colors before gdk_gc_set_*ground calls. You see the
black color because of zero *pixel* field value in foreground/background
structures. If you want to avoid color allocation - use
gdk_gc_set_rgb_*_color functions:
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Graphics-Contexts.html#gdk-gc-set-rgb-fg-color
Olexiy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]