Search code examples
drawingx11antialiasingxlib

Enable antialiasing using Xlib


I'm trying to develop a custom set of libraries for creating GUIs in Linux, with, you know, widgets, buttons, etc. So I'm now learning to creating user interfaces using X11 and its Xlib. I get to the point of having a nice window of a size specified, at a position specified, of a specified background color, and the possibility of drawing points, rectangles, arcs. However as I drew my first circle I got really disappointed by the fact that the circle is not antialiased. I can see every single pixel as a square.

Now the question is easy. Is there any way to tell X: please antialias anything before drawing? Or do I have to avoid using XDrawArc and use a custom function which calls XDrawPoint for each point of the circle? Or there is a third solution?

Thanks in advance.


Solution

  • The short answer is "no". Xlib doesn't do anti-aliasing.

    The longer answer is "you can use a higher level API such as Cairo Graphics". It's not necessary to roll your own.