Filling Trapezoids with XRender

Sunny Sachanandani sunnysachanandani at
Sat Jun 12 09:17:39 PDT 2010

I have this small section of code:

    XRenderColor foreground = {0xffff, 0x0000, 0x0000, 0xffff};
    Picture fill = XRenderCreateSolidFill(dpy, &foreground);
    XTrapezoid trap; = trap.left.p1.y = trap.right.p1.y = XDoubleToFixed(0.25);
    trap.bottom = trap.left.p2.y = trap.right.p2.y = XDoubleToFixed(0.50);
    trap.left.p1.x = trap.left.p2.x = XDoubleToFixed(0.25);
    trap.right.p1.x = trap.right.p2.x = XDoubleToFixed(0.50);

    XRenderCompositeTrapezoids(dpy, PictOpSrc, fill, win_pict,
                               XRenderFindStandardFormat(dpy, PictStandardA1),
                               0, 0, &trap, 1);
    XSync(dpy, False);

win_pict is a Picture created for the Window that I am drawing on. The
Window is 400 by 400.  I have been able to use XRenderFillRectangle(s)
as well as XRenderComposite (with a pixmap loaded from an xpm file) on
the same window. However I am unable to get this to work.

I have checked the requests received by the xserver using this handy
utility called xtruss
( and they seem to
be fine.

Also I attempted to use XRenderAddTraps on a mask of 1 bit depth that
I created and use that mask in XRenderComposite but that also didn't


Sunny Sachanandani
BITS Pilani, Pilani Campus


More information about the xorg-devel mailing list