Xrender related question
Thomas Jaeger
thjaeger at gmail.com
Mon Feb 23 23:21:17 PST 2009
Alexei Babich wrote:
> Hello, all.
>
> Having executed a piece of code listed below, I get a green window (as a result of calling XCreateSimpleWindow()) and a black rectangle on top of it (XRenderFillRectangle()). I still get just black, whatever color I set in the 'col' structure.
> XRenderFindVisualFormat() points to the data field shown on the screenshot attached to this letter.
> Why doesn't the color of the rectangle depend on the 'col' parameters?
>
> //some color
> col.red = 0;
> col.green = 127;
> col.blue = 250;
> col.alpha = 250;
XRender uses 16-bit colors. If you multiply these numbers by 257 you
should be fine. I would use 0xffff for the alpha value, though, if the
intention is to make the rectangle fully opaque. Also, unless there is
a specific reason to use XRender directly, I would recommend using the
higher-level cairo library instead.
More information about the xorg
mailing list