Some MyPaint internals are documented here, for a nice overview.
 Technology Overview
- Mostly written in Python with PyGTK
- The GUI is constructed in the code directly (no GUI builder used)
- The brush engine itself is an independent LGPL library, written in C++
- Brush dabbing and blitting code is written in C++, as a python extension module
- The C++ dialect is headerfiles-only C with classes (no fancy C++ features or STL)
- Some of the C code (brushsettings) is generated with python
- Relatively small codebase, around 50000 lines of code (August 2012)
 Code Overview
Here is a simplified module dependendcy overview (some "weak" dependencies are not shown):
OpenOffice files for those images are in the doc/ directory of the mypaint repository.
 Pixel Format
 Surface Format and Rendering
MyPaint stores its pixel data inside tiles of a fixed size. The TiledSurface class allocates memory just for the tiles that you paint on. When the screen is updated, the tiles are composited into a temporary rectangular pixbuf, which is then passed to Cairo for rotated and zoomed rendering.
During painting, all tiles touched by the stroke are composited completely, but the update region is clipped to the bounding box of the new dabs.
MyPaint brush functionality is separated in a C library called brushlib that can be used in other applications. Check this page for more information.
 First Order Lowpass Filter
They are used in many places in the brush code but most importantly to filter the velocity. This is how it is done when reacting to timestamped events:
fac = exp(-dt/T1); output = fac*output + (1-fac)*input;
dt: time passed since last calculation
T1: time constant. After this time, about 2/3 of the difference between input and output is gone.
If the input is a position, then
filtered_velocity = input - output