Looking for XRender examples

KAMALNEET SINGH kamalneet.s at samsung.com
Thu Dec 6 02:44:10 PST 2007


Clemens Eisserer wrote:
> Hello,
> 
> Does anybody know tutorials for learning the XRender API?
> I found many tutorials for X11's primitive drawing but for XRender
> there is almost no developer documentation available.
> 

You can look at xclock code, and also the code of Render-related Xft functions it calls.
Keith has screenshots of simpler applications at http://people.freedesktop.org/~keithp/render/, they can serve as tutorials, but I don't know where is the source code.

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 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. See "Trapezoids" in http://gitweb.freedesktop.org/?p=xorg/proto/renderproto.git;a=blob_plain;f=renderproto.txt


More information about the xorg mailing list