Trunk: new framework for curves
Emanuele Tamponi
emanuele at valinor.it
Fri Oct 20 16:30:14 CEST 2006
Hello,
I begun the port of my code from 1.6 but I stopped it because Qt Containers
and Iterators are changed so much that they don't permit to my "custom"
iterator class to work well. This class is, as far as I know, a big mess
(and, since I wrote it, I know it well :) so it needs to be rewritten.
But, since there are other problems and wishes for my framework, I would like
to rewrite it all to add functionality and to use cleaner coding schema and
patterns. I list here the ideas I'd like to implement:
1- The tools based on my framework could use their own "strategy" to handle
and create the curve. I mean, while the code for the tools itself (events and
the like) can be just inherited from a base KisCurveTool, the real methods
that create the curve are defined by a class owned by the specific tool: this
class (I call it "strategy" but it as little to do with the strategy pattern)
will decide what to do when a curve is started or moved, when a new clicks
occour etc. To make an example, take two different tools: bezier tool and
circle tool.
- Bezier tool needs to add 3 controls points for each new click and manages
more than one "segment".
- Circle tool just take the starting point and the end point, and doesn't
manage more than one "segment" (I mean, once the starting point and end point
are added, the curve is committed)
I hope this is clear to all of you. Probably the strategy class can be
removed and all the code for handling the curve can be put in the base
KisCurveTool and then inherited and possibly modifed by all the derivate
tools.
2- All types of continous curves can be converted to bezier curves. So, once
you draw a circle or a square, you can right-click and "convert" it to a
bezier curve. The bezier tool is automatically activated and you can begin
modify your curve with the power of bezier controls.
3- Each "curve" could reside in a KisCurveLayer that give you the possibility
of storing the Curve data in memory after the curve is committed (in Krita
1.6, after the commit of the curve, you cannot edit it anymore). The layer
can be moved, and a right use of the transform tool permits that the curve
can be transformed or rotated (or is it better to implement my own
rotating/transforming methods?). If you want to edit the curve after it's is
committed, you can again rightclick on the layer and click on "restore the
curve": the bezier tool is activated and you can change again your curve.
Obviously this needs to update the "curve data" after each transformation,
and it will have some problems when "merging" two curve layers (the curve
data is merged too? And in what order?)
These are my ideas and I really would like to ear what do you think about
them. I'd like to use Flake code too, if it's possible, so I wouldn't
duplicate anything.
*ALL* types of critics are welcome! :) And other ideas too. Put here what do
you think a krita user would need when using paths. I think that the
restoring of a previously drawn curve is the main feature we need. And also
curve transformation is needed. Conversion of curves is something a photoshop
user could really miss... But probably there are other things we need to take
into account.
Sorry for the really long post :) Thank you for your patience :)
_____
Emanuele
More information about the kimageshop
mailing list