Issue #3205: Port to MyPaint Brushes (version 2)

This patch attempts to resolve #3205 (closed)

This patch ports our MyPaint code to use the MyPaintSurface2 API from libmypaint 1.5.0+, allowing us to support version 2 MyPaint Brushes correctly. A basic overview of changes made can be seen in https://github.com/mypaint/libmypaint/issues/101#issuecomment-813000137

As a quick summary, this patch:

  • Adds "new" MyPaint brushes to GIMP by loading from /share/mypaint-data/2.0/ rather than /1.0
    • Also allows for other v2 brushes to be added by the user
  • Implements "Posterize" blending code, enabling brushes with "Posterize" settings to work correctly (See "Posterizer" brush for example)
  • Takes into account the zoom factor and rotation of the canvas when painting (at least, we pass the information from GIMP into MyPaintSurface2)
  • Adds tool option to adjust "Gain" brush parameter like MyPaint. This is a multiplier for input pressure - so for instance, if you're using a mouse you can simulate pressing harder or softer on the tablet surface to change the brush output.

Caveat: This patch does not implement the spectral/pigment blending feature. That code is more complex and is "optional" in a sense - if you set the pigment value to 0 (either in MyPaint or the reference implementation linked above), the code behaves like GIMP's current MyPaint code. I thought it would be easier to implement the initial MyPaintSurface2 port, verify it works correctly, then tackle implementing spectral blending as a separate project.

Edited by Alx Sa

Merge request reports

Loading