[Xcb] defining the color

strinter streenter at gmail.com
Wed Feb 2 00:17:08 PST 2011


Dear members of the XCB mailing list!

I've got a question related to the definition and usage of colors. What
I want to do is to try to fill the circle with gray colour. I do the following

...

  c = xcb_connect (NULL,NULL);
  screen = xcb_setup_roots_iterator(xcb_get_setup (c)).data;
  win = screen->root;
  cmap = xcb_generate_id (c);
  xcb_create_colormap (c, XCB_COLORMAP_ALLOC_NONE, cmap, win,
screen->root_visual);

  rep = xcb_alloc_color_reply (c, xcb_alloc_color (c, cmap, 128, 128,
128), NULL);

  if (!rep)
    return 0;

  foreground = xcb_generate_id (c);
  mask = XCB_GC_FOREGROUND|XCB_GC_GRAPHICS_EXPOSURES;
  //  values[0]=screen->black_pixel;
  values[0]=rep;
  values[1]=0;
  xcb_create_gc(c,foreground,win,mask,values);

....
  (from a separate function call)

  xcb_arc_t arc[2];
  arc[0].x=x-r;
  arc[0].y=y-r;
  arc[0].width=2*r;
  arc[0].height=2*r;
  arc[0].angle1=0<<6;
  arc[0].angle2=360<<6;
  xcb_poly_fill_arc(c,win,foreground,1,arc);


but eventually end up with the green color not responding to the
values of RGB parameters. Does anybody know what may be the source
of the problem?

Thanks.


More information about the Xcb mailing list