Python Painting API
This merge request is based on a previous merge request by Scott Petrovic. It adds function calls into the Document class that allows the user to paint using the python API. Everything is implemented using the KisFigurePaintingToolHelper
class.
Test Plan
Run this script (created by Scott to test his API):
from krita import *
activeDocument = Krita.instance().activeDocument()
# paint a line
pointOne = QPoint(0,0)
pointTwo = QPoint(900, 700)
activeDocument.paintLine(pointOne, pointTwo)
# paint a rectangle
paintRect = QRectF(100, 100, 500, 200)
activeDocument.paintRectangle(paintRect)
# paint ellipse
paintRect = QRectF(400, 100, 200, 600)
activeDocument.paintEllipse(paintRect)
# paint polygon
polyPoints = []
polyPoints.append( QPointF(20,20) )
polyPoints.append( QPointF(120,820) )
polyPoints.append( QPointF(920,120) )
activeDocument.paintPolygon(polyPoints)
# paint path
path = QPainterPath()
path.moveTo(500, 500)
path.cubicTo(699, 0, 650, 650, 999, 999)
path.cubicTo(0, 99, 50, 50, 0, 0)
activeDocument.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.