Phase-1 GSoC-Krita

Hey everyone !

I have recieved the Phase 1 evaluation from the mentors . For the Phase 1 I planned to implement two new features in the Reference Image Tool. Most of the work for them with updating the transformation for Pinned Reference Images Layer and the Crop in Reference Image is complete .

1. Pin Reference Images

Reference Images and its layer in Krita is a sub-class of vector shapes (the KoShape/flake in KDE can be used to wrap text or images etc) . This was difficult in terms of the individual shapes cannot have different transformation and shapes are objects which beongs to the document so they are transformed with the document. So when the canvas is modified with rotation , Pan or Zoom it updates the QPainter transformation everywhere including the reference image tool . But since Reference Image Layer are also a type of shape Layer so its transformation is calculated with the KisShapeLayer transformation as well . This way the image and canvas transformation can be applied on the reference images.

I have implemented both of these to get it working with Pinning but there’s a bit difficulty on unpinning the Layer which needs to take the same transformation ignoring the intermediate change done during the Pin operation , this is still work in progress .

2 Integrate Crop

Second feature was allowing reference images to be cropped in krita easily with the sliders and the handles directly. For this it needs to allow the handles to be manipulated with the new decoration and connecting those options with the UI . Finally adding an undo step with KUndo2Command to make the crop non destructive . This part is somewhat done except of some minor tweeks & polish left .

Here is gif for the feature also

Now for the second phase , I plan to add Syncing and updating the reference images from its file path so it always renders the updated image . This can be done with the QFileSystemWatcher class in Qt . There is a wrapper for this in Krita already which is used
for File Layer .

Cheers & Thanks for reading :)

Written on July 17, 2021