Skip to main content

Backend Documentation

Documentation

This section concisely describes fundamental aspects of the project’s technology, including files and technical concepts to help developers conceptualise MyPaint. The most detailed documentation for the project will always be contained within the source code.

Warning

This section is heavily in development

Contributor Responsibilities

Technology Overview

Here is a simplified (and somewhat outdated, sorry!) module dependency overview (some “weak” dependencies are not shown):

requirementDiagram
requirement test_req {
    id: 1
    text: the test text.
    risk: high
    verifymethod: test
}

element test_entity {
    type: simulation
}

test_entity - satisfies -> test_req

Less simplified version

Tooling

MyPaint (the painting application) is written in Python. MyPaint uses GTK for its user interface, some of the more complicated bits are designed in Glade. Some parts are coded in C++ for speed. Its brush engine is written as a portable C++ library.

  • Building, Testing, & Packaging
    • Setup.py uses distutils
    • Tests use nose
    • GitHub actions for CI
  • GUI
    • PyGObject (PyGI)
    • Parts of the GUI are constructed in GLADE, other parts in the Python code
  • Canvas
    • NumPy
    • Cairo
  • Brush engine
    • libmypaint

Windows

MyPaint uses MSYS2 for porting onto the Windows platform.

Pages in this Section

Unit Testing

We like to use doctest in Python code. There are a number of standalone test scripts too.

GUI

MyPaint uses GObject-Introspection (“GI”) to access certain third-party libraries. This is a mechanism that allows library code written in a compiled language to be used by scripting languages. It’s normally not possible to do this directly. The Python library for using other libs through GI is called PyGObject or PyGI.

Data

How MyPaint handles data

Canvas

How MyPaint renders the canvas

Build Process

MyPaint’s build system is due to be replaced. Currently, the MyPaint application is built with PyPa’s setuptools, with heavy utilisation of distutils. The entry point to building MyPaint is setup.py, configured by setup.cfg. This page details how MyPaint’s source code is transformed into a working application.

Brush Engine

How MyPaint places content on the canvas

MyPaint is considering moving to a linear light workflow internally: this has significant artistic and aesthetic benefits for users. We’ll attempt to retain backwards compatibility for older images to reduce the impact of this change as much as possible. Benefits of linear light Linear light composition affects the way mid-range alpha pixels combine with the layers below them. You might see less fringing at the edges of brushstokes, and should see fewer artefacts around the edges of strokes when scaling.