[Xcb] dealing with colors

Barton C Massey bart at cs.pdx.edu
Wed Aug 6 22:58:42 PDT 2008

You might look at xcb-demo/julia/julia.c, which contains an
example of how to call xcb_alloc_color() and process the
reply.  It's hard to know where you went wrong without some
actual source code to look at, so post that if you like.
One common source of confusion leading to blackness is that
X color components are 16 bits wide, and thus need to be
left-justified in that size field to work.

Hope this helps.


In message <5d3af1ee0808061519k5763c3as9292b43bb09fcc at mail.gmail.com> you wrote:
> I started few days ago a gui creation with Xlib, but i found xcb yesterday
> and decided try it. I modified my code quiet easily (it wasn't really long)
> except for the color. How should i replace
>     XAllocColor(WinInf->dpy, WinInf->cmap, &c);
>     XSetForeground(WinInf->dpy, WinInf->gc, c.pixel);
> I tried by using xcb_alloc_color but i didn't succeed (all my drawings were
> black).
> Any idee?
> Else, is there a simple example just drawing colored points in an empty
> window?
> thanks in advance!

More information about the Xcb mailing list