Added Bayer dithering option to Gradient Tool
Description
This MR adds a new Bayer dithering option to Gradient Tool. It allows to create retro-looking pixelated gradients, often used in pixel art.
New "Dither" combo box has been added to Gradient Tool's options docker with the following dithering modes:
-
None
No dithering will be applied. In this mode, gradient tool will work exactly as it did before these changes, when "Dither" checkbox was left unchecked. This mode is the default.
-
Blue Noise
Applies Blue Noise to gradient. Effect is exactly the same as when "Dither" checkbox was checked before these changes.
-
Bayer Matrix 2x2 / 4x4 / 8x8
Bayer dithering will be applied to gradient. There are three sizes of Bayer matrix to choose from, each with a different style and level of detail: 2x2, 4x4 and 8x8.
Choosing Bayer dithering enables a new option: "Dither steps". Its goal is to simulate limited color palette of retro systems, by sampling only a selected number of colors from currently selected gradient. For example, when "Dither steps" is set to 2, gradient will be drawn with just two colors, sampled at 0% and 100% of the current gradient. For 5 steps, colors will be sampled at 0%, 25%, 50%, 75% and 100%.
Examples
Test Plan
Use Gradient Tool with all possible combinations of "Dither" option. Try different values of "Dither steps".
When this option is set to "None" or "Blue Noise", Gradient Tool should behave exactly as before changes introduced in this MR.
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.


