Filling Trapezoids with XRender

Sunny Sachanandani sunnysachanandani at gmail.com
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.top = 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
(http://www.chiark.greenend.org.uk/~sgtatham/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
work.

Thanks.
-----------------------------------------------------------------------------

Sunny Sachanandani
BITS Pilani, Pilani Campus
2008B4A7580P

+91-9784313832
+91-9967247780


More information about the xorg-devel mailing list