[Xcb] dealing with colors

Barton C Massey bart at cs.pdx.edu
Thu Aug 7 09:11:20 PDT 2008


Oh, you're looking for xcb_aux_change_gc() and friends from
xcb/util.  This will let you set the GC foreground pixel in a
convenient manner.

	Bart

In message <5d3af1ee0808070713j3901351dk91646d6fb7854b60 at mail.gmail.com> you wrote:
> --===============0365994741==
> Content-Type: multipart/alternative; 
> 	boundary="----=_Part_50367_5973355.1218118391863"
> 
> ------=_Part_50367_5973355.1218118391863
> Content-Type: text/plain; charset=ISO-8859-1
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
> 
> the code of julia.c doesn't help me because it use XCBImagePutPixel  and the
> color is directly given in parameter, but I'm drawing directly in the window
> using xcb_poly_segment, xcb_poly_point... and the color can't be given
> directly. That's why i'm looking to a function corresponding to
> XSetForeground to select the color i want.
> I hope i'm clear enough, else i'll try to simplify my program to post it
> here when i have time.
> 
> 2008/8/7 Vincent Torri <vtorri at univ-evry.fr>
> 
> >
> > Hey,
> >
> >
> >  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?
> >>
> >
> > see in demo/ the code of 'julia.c'
> >
> > Vincent
> >
> 
> ------=_Part_50367_5973355.1218118391863
> Content-Type: text/html; charset=ISO-8859-1
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
> 
> <div dir="ltr">the code of julia.c doesn&#39;t help me because it use XCBImagePutPixel&nbsp; and the color is directly given in parameter, but I&#39;m drawing directly in the window using xcb_poly_segment, xcb_poly_point... and the color can&#39;t be given directly. That&#39;s why i&#39;m looking to a function corresponding to XSetForeground to select the color i want.<br>
> I hope i&#39;m clear enough, else i&#39;ll try to simplify my program to post it here when i have time.<br><br><div class="gmail_quote">2008/8/7 Vincent Torri <span dir="ltr">&lt;<a href="mailto:vtorri at univ-evry.fr">vtorri at univ-evry.fr</a>&gt;</span><br>
> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
> Hey,<div><div></div><div class="Wj3C7c"><br>
> <br>
> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> I started few days ago a gui creation with Xlib, but i found xcb yesterday<br>
> and decided try it. I modified my code quiet easily (it wasn&#39;t really long)<br>
> except for the color. How should i replace<br>
>  &nbsp; XAllocColor(WinInf-&gt;dpy, WinInf-&gt;cmap, &amp;c);<br>
>  &nbsp; XSetForeground(WinInf-&gt;dpy, WinInf-&gt;gc, c.pixel);<br>
> <br>
> I tried by using xcb_alloc_color but i didn&#39;t succeed (all my drawings were<br>
> black).<br>
> <br>
> Any idee?<br>
> Else, is there a simple example just drawing colored points in an empty<br>
> window?<br>
> </blockquote>
> <br></div></div>
> see in demo/ the code of &#39;julia.c&#39;<br><font color="#888888">
> <br>
> Vincent<br>
> </font></blockquote></div><br></div>
> 
> ------=_Part_50367_5973355.1218118391863--
> 
> --===============0365994741==
> Content-Type: text/plain; charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
> 
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
> --===============0365994741==--


More information about the Xcb mailing list