Add Marker blend mode
This MR adds a new Marker blend mode, which works like Alpha Darken, but properly adheres to channel flags (so it e.g. obeys alpha lock and inherit alpha) and interpolates colors without artifacts. When you use it on a brush in build-up mode, it will only increase opacity up to your stroke's intended opacity, but not compound what's on the layer, while the colors get interpolated. It works like Paint Tool SAI's marker tool, hence the name.
That the Alpha Darken blend mode behaves differently is a bug I think, but one that isn't particularly relevant to the Wash paint mode that it's primarily used for, since you're usually only dealing with a single or close-enough color and there's not going to be any channel flags to observe. So this MR does not alter the behavior of Alpha Darken, any modifications are fenced off with if constexpr to avoid performance regression.
Here's a comparison of strokes with a build-up brush in the Marker mode on the left and the Alpha Darken mode on the right. Note the hard pixel edges and halo on the latter.
And here's Alpha Darken used as a layer blend mode, also has artifacts:
And this is what it looks like with the Marker blend mode:
This discussion in Drawpile's issue tracker has more examples. The file used for the example images above is this one: adarken.ora
The documentation MR is documentation/docs-krita-org!359
Test Plan
As a marker brush:
- Create a blank layer.
- Use a brush with opacity dynamics and a low hardness so that you can see things better.
- Set the brush to Build-Up paint mode.
- Set the blend mode on the brush to Alpha Darken.
- Draw strokes in the same color at different opacity. Observe that the opacity doesn't compound like it should.
- Change the color and draw strokes at different opacity. Observe that the opacity behaves the same, but there's color artifacting in low-opacity areas.
- Set the blend mode on the brush to Marker.
- Draw strokes in the same color again, observe the same behavior as for Alpha Darken.
- Draw strokes in a different color, observe the same opacity behavior, but no color artifacts.
You can repeat the above in wash mode. Note that the opacity will compound across multiple strokes in this case, since the temporary layer in Wash mode has 100% opacity.
As a layer blend mode:
- Open adarken.ora
- Observe the artifacts in the color interpolation caused by Paint Layer 2 in Alpha Darken mode.
- Change the blend mode of Paint Layer 2 to Marker and observe that the colors get interpolated properly.
You can repeat the above in a previous Krita version and compare the behavior of the Alpha Darken to ensure it has not changed.
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) -
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy. -
Does the patch add a user-visible feature? If yes, is there a documentation MR ready for it at Krita Documentation Repository?
Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.


