Looking for XRender examples

Carl Worth cworth at cworth.org
Thu Dec 6 10:11:05 PST 2007


On Thu, 06 Dec 2007 10:44:10 +0000 (GMT), KAMALNEET SINGH wrote:
> Some notes on xclock's usage of XRender:
> * Destination surface is created using XftDrawPicture.
> * Source surface is created using
>   XftDrawSrcPicture. XftDrawSrcPicture uses XCreatePixmap to create a
>   1x1 pixmap and then uses it as a drawable to create a new Picture. And
>   then uses XRenderFillRectangle to draw the color onto it.

For an application using XRender "only" you can use
XRenderCreatePicture instead of relying on the Xft library as well.

As soon as you want to render text through XRender, you will quickly
find that there's quite a bit of work required to manage everything
necessary. At that point, you might find it quite helpful to use an
existing library. Originally, Xft was the recommended library, (and
should still work fine, of course). But today active development has
instead moved to cairo for XRender-based rendering of text.

> * For rendering, xclock calls XRenderCompositeDoublePoly, with some
> * non-NULL mask format (A8 in my test run). For non-null
> * mask-format, Render specification says that first a temporary
> * alpha picture is created and rasterization done on it.

That function was a mistake in the XRender library. There is no
protocol support for passing a polygon of doubles, so instead this
function tessellates and makes a CompositeTrapezoids request. But the
tessellation it does is extremely inefficient and often wrong. So
better would be to do your own tessellation, (or use a library like
cairo that will do tessellation for you).

I hope that helps,

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20071206/140b5cf9/attachment.pgp>


More information about the xorg mailing list