Add Knife Tool prototype to Krita
Can be merged now
-
without removing/commenting out the debug output first -
without a button to create the first rectangle [or rather, an indication for the user that they need to use it on a vector layer first]
Knife tool
Functionalities
-
Cutting through a shape with a gap width -
Three gap widths to choose from -
Remove a gap (merge shapes) -
Increase or decrease gap's width by a specified amount -
Set gap width to a specified amount -
Snap to center of the page -
Snap to horizontal and vertical -
Snap the beginning to 1/3 and 1/2 -
Snap the beginning to 1/3 and 1/2 of a shape -
Move the gutter (preserves the angle of the line) -
Move the end of the gutter (should slide the points along the shape edges or something like that -> remember about the intersection thing to have nice angles if the gutter hides the corner)
Points features:
-
Correct points to be on one line
Intermediate features (used for other things):
-
move point in this direction (usually: along the line) this distance -
when you have two lines, find the intersection and use it for the merging of shapes (I mean QLineF does this, just remember to use it for that feature) -
function to snap line to an angle with eps angle and number of angles/angle increment (find if it exists, first!) -> used for both kinds of snapping in the cutter (snapToClosestNiceAngle does this)
Bugs to fix
-
Cutting off the top-left corner of a rectangle gives wrong results (now something else, but can't find the test case) -
Parameters aren't remembered -
Undo deselects stuff -
The width of the gap is kinda weird, it seems consistent but isn't, possibly because of some issues with transformations (seems related to the line length for some weird reason) -
Path 1/2 = 0 elements? -
Very slow when there is a lot of shapes selected -> only cut through shapes where it matters (now it doesn't get that slow due to fixing the other issue, but still would be good to fix) -> I tried to fix that but it doesn't really make it all that much faster...
Test Plan
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.
Edited by Agata Cacko

