Expose stroke and fill styles to painting API
As suggested by @deiflou in the previous MR (2195), this extends the painting API to allow changing the stroke and fill styles of what will be painted.
There's also two minor fixes to the comments snuck in this commit.
Test Plan
- Before recompiling, delete the
$BUILDROOT/_build/plugins/extensions/pykrita/sip/_tmp
folder so it gets regenerated. - Run the new version of the test script:
from krita import *
activeDocument = Krita.instance().activeDocument()
activeNode = activeDocument.activeNode()
print(activeNode.paintAbility())
# paint a line
pointOne = QPoint(0,0)
pointTwo = QPoint(900, 700)
activeNode.paintLine(pointOne, pointTwo, "BackgroundColor")
# paint a rectangle
paintRect = QRectF(100, 100, 500, 200)
activeNode.paintRectangle(paintRect, "ForegroundColor", "BackgroundColor")
# paint ellipse
paintRect = QRectF(400, 100, 200, 600)
activeNode.paintEllipse(paintRect, "None", "Pattern")
# paint polygon
polyPoints = []
polyPoints.append( QPointF(20,20) )
polyPoints.append( QPointF(120,820) )
polyPoints.append( QPointF(920,120) )
activeNode.paintPolygon(polyPoints, "None")
# paint path
path = QPainterPath()
path.moveTo(500, 500)
path.cubicTo(699, 0, 650, 650, 999, 999)
path.cubicTo(0, 99, 50, 50, 0, 0)
activeNode.paintPath(path, "ForegroundColor", "Pattern")
# paint along a text outline path because why not
path = QPainterPath()
font = qApp.font()
font.setPointSize(40)
path.addText(QPointF(50,50), font, "Krita: Digital Painting, Creative Freedom")
activeNode.paintPath(path)
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.