Linux Graphics Programming

There was a time when embedded system developers didn’t need to worry about graphics. When you have a PIC processor and two-line LCD, there isn’t much to learn. But if you are deploying Linux-based systems today, graphics are a real possibility. There are many options for doing Linux graphics including Wayland, X11, and frame buffers. Confused? This tutorial can help. The sections on Wayland and Mir are under construction, but that’s probably not what you are going to be using on a typical hacker project for the foreseeable future, anyway.

Of course, even inside those broad categories, you have multiple choices. If you are doing X11, for example, you can go low-level or pick any of a number of high-level libraries.

The tutorial assumes you understand C and basic Linux programming. It has two sections, really. One on how to plot points on the screen and another that covers basic graphics algorithms for drawing things like circles. We’d be interested in some benchmarks about the relative performance between the different raw drawing methods.

If you have a graphics-intensive application, the Raspberry PI 3 isn’t too bad. However, you can get dedicated hardware that will do better. You can even roll your own if you are so inclined.

23 thoughts on “Linux Graphics Programming

    1. I started out with curses in a project (, only to then re-implement it with the few escape sequences I actually needed. ui-performance improved drastically. Curses is a nice prototyping tool, but unless you need all of its advanced features, you might be better off just doing it “by hand”. not too hard.

  1. The first example compiles and caused a seg fault when I ran it. Then I suspected that the fd0 device might need root permission so I ran it with sudo and now it turns my screen purple. It is not as the author wrote a fleeting effect so it is easy to note that the program worked.

    The primitive shape code requires a function called draw() which is not defined anywhere.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.