We talked in Berlin at the KOffice Sprint about my Google Summer Of Code proposal and we decided to start with feature “Rotation of the Canvas”.The use-case is that you can rotate canvas in Krita according the rotation of your tablet. Basiclly in three dimensions. Also you can rotate the canvas for better orientation when the 3D brush will appear in Krita.
First step for canvas rotation was drawing some UML diagram and get the idea how it looks in Krita and in KOffice libs (flake). I used Umbrello for KDE4. I really like the feature which import classes from C++ code. That’s nice. It is quite stable but has some issues here and there. I reported two bugs.
We want to support rotation of the canvas for both OpenGL-based canvas and QPainter-based canvas. There is already some nice support in Qt for it.
Some steps I need to solve
1. Krita renders the whole image (layers and colorspace) into QImage or QPixmap and then displays the result.
2. Let’s rotate the rendered image around center using QPainter and QTransform.
3. The canvas is bigger when it is rotated, so I need to change the size of the canvas
4. Zoom has to be taken into account (points, inch and pixels are present in the API).
1. The coordinates that comes from canvas events has to be transformed into 2D coordinates properly.
It seems easy. But it is complicated much more then one would think.Integrate it into Krita is the biggest problem. Math issues like transformations are already done in Qt.
So first week I spent time to investigate all related classes, I investigated canvas in Karbon which in infinte and we discussed that it would be cool to have infinte canvas for Krita. I realized that it can’t be adopted from Karbon, because for Krita it is more complicated. And then I started to use git-svn as my work on Krita Cavnas could break some stuff in trunk and creating gsoc-canvas branch seems to be the solution. Git is nice so far.