<div class="gmail_quote">On Sat, Apr 3, 2010 at 11:52 PM, Marc <span dir="ltr">&lt;<a href="mailto:pe.marc@free.fr">pe.marc@free.fr</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
here is the first version of my proposal for a new transformation tool<br>
for krita. I&#39;d like some comments !<br>
<br>
Title: Image Tranformation Tool for Krita<br>
<br>
Abstract:<br>
<br>
Since Krita is to be used also for shading and texturing, there are some<br>
image transformations that it needs to provide. Indeed, a professional<br>
even reported that, for texturing, image manipulations were the most<br>
basic and important tools used.<br>
<br>
While Krita already covers most of the essential features concerning<br>
color correction, layering, and painting, the current image<br>
transformation tool lacks crucial features such as shearing image,<br>
changing image perspective, or warping image (plus some pre-written<br>
transformations using warping).<br>
What&#39;s more, the current tool shows some problems in conception : the<br>
transformation process is done each time the user rotates or scales the<br>
selection, which deterioriates the image each time a little bit more.<br>
The tool should work and perform each transformation on a temporary low<br>
quality representation of the selection, and perform the complete<br>
transformation on the initial selection only once.<br>
Ultimately, the current transformation tool is not functional nor<br>
ergonomic : a tool like that needs to have shortcuts, key modifiers, and<br>
some buttons (even if it is just a few) to facilitate its use.<br>
<br>
Hence the aim is to develop from scratch a new transformation tool for<br>
krita, which will be at the same time fast, quite exhaustive, and<br>
comfortable to use.<br>
<br>
Implementation :<br>
<br>
-First, I will focus on rewriting from scratch the current<br>
transformation tool (only the code for the already-existing scale and<br>
rotation transformation will likely be re-used), so that it keeps the<br>
original shapes of the selection, and records all the modifications done<br>
by the user (basically this will be done by updating a QMatrix at each<br>
step). When the user is finished with the transformation, the tool will<br>
then apply the complete resulting operation on the original shapes,<br>
which will replace the current ones.<br>
<br>
-Then, I will add the shear transformation (which will be immediate from<br>
an algorithmic point of view, since it is simply a linear transformation<br>
that Qt can perform for us using a QMatrix). To shear the image, the<br>
user will only have to hold a key modifier and click on the side he<br>
wants to move. I will also add a center for the rotation, which can be<br>
moved by the user.<br>
<br>
-Then comes the &quot;change perspective&quot; transformation, which won&#39;t be as<br>
easy as shearing : since it is not a 2D transformation, it cannot be<br>
done using a 2x2 matrix like QMatrix. However, such a transformation can<br>
be done using a 3x3 matrix, and projecting the coordinates on the plan<br>
of the screen. Perhaps the best way to implement it is to change<br>
directly the KoShape class to accept 3D transformations. Thus, this may<br>
take some time : I will have to create a 3x3 Matrix class with basic<br>
operations such as multiplication, inversion, determinant and<br>
changePerspective, and then write the methods for 3D transformations in<br>
KoShape. In Krita the user will be able to rotate the image around an x<br>
axis and around an y axis by holding a key modifier and moving the mouse<br>
(movement in the x direction will perform a rotation around the y axis<br>
and vice versa).<br>
<br>
-Finally, I will implement warping. Warping enables the user to<br>
transform the image by modifying some of its points : a grid is<br>
displayed temporarily on the selection and the user moves its<br>
intersection points to deform the image. This will likely take a great<br>
amount of time in proportion to the other transformations. It is really<br>
a challenge from an algorithmic point of view : it is not a linear<br>
transformation, and thus cannot be done simply by multiplying matrices.<br>
So first i will have to do some research, read some papers to come up<br>
with an algorithm. Implementing the interface will also be quite<br>
challenging.<br>
<br>
-If i have some time left, I will add some pre-written transformations<br>
using the warping transformation.<br>
<br>
Some details about how the user will use the different transformations<br>
on this scheme :<br>
<a href="http://dl.free.fr/bUw3Loddg" target="_blank">http://dl.free.fr/bUw3Loddg</a><br>
And a mockup for the Tool Options widget :<br>
<a href="http://dl.free.fr/qqX3RkbjD" target="_blank">http://dl.free.fr/qqX3RkbjD</a><br>
<br>
Timeline :<br>
<br>
Although my exams finish the 21th of May, I will still have to work on a<br>
project for school until the 11th of June (but then I will be entirely<br>
free until september). Hence, I would start working on my transformation<br>
tool before the official beginning of the Google Summer of Code, in<br>
parallel of school.<br>
This would be a preliminary schedule :<br>
Apr 20 - I start right away with rewriting the current transformation<br>
tool.<br>
May 3 - The tool should be rewritten, enabling like before the user to<br>
rotate and scale the image. I will be taking 10 days to prepare for the<br>
exams. My exams will then take 10 days. Afterwards I will have 3 weeks<br>
to work on a project which will close the school year.<br>
June 11 - implement the shear transformation and the change perspective<br>
transformation (2 weeks).<br>
July 2 - work on the details of the interface to have something polished<br>
for the midterm evaluation.<br>
July 9 - begin the work on the warping transformation. The<br>
investigations will likely take about 1 week and the implementation of<br>
the algorithm and the interface will take easily 2 weeks.<br>
July 30th - polish the interface, bug corrections, adding pre-written<br>
transformations using warping (until the pencils down date).<br>
<br>
About me :<br>
<br>
I am a first-year french student in a school of engineering (Ensimag :<br>
National Superior School of Computer Science and Applied Mathematics). I<br>
have been using essentially open source programs for approximately 5<br>
years now, and, since January, i have made several small contributions<br>
for Krita (for example i fixed/added the local selections). Thus, I am<br>
already familiar with krita&#39;s code.<br>
I have grown an interest in image manipulation and transformation since<br>
last year, while I was working on image resizing techniques and basic<br>
edge detection methods for a school project last year. This project<br>
resulted in a small program written in Qt, which means I am comfortable<br>
using Qt and C++, and I am not afraid to read scientific algorithmic<br>
papers which may be needed to complete my project.<br>
<br>
</blockquote></div><br>Have a look at QTransfrom that is a 3x3 matrix allowing perspective transformations. I think changing KoShape is beyond the scope for this project and it shouldn&#39;t be needed for it. Did you take a look a the specification for the new Gimp transform tool? That can provide some ways to avoid forcing the user to always use shortcuts.<br>
<br>I the timeline I noticed a small gap where is says &quot;(2 weeks)&quot;, but it&#39;s actually three weeks till July 2nd.<br><br>Otherwise it looks good. <br>