plan for introducing new curve widget

nospam at xibo.at nospam at xibo.at
Mon Aug 30 18:40:47 CEST 2010


hi,
boud asked me to imporve the curve widget, so that it is more versatile.
i've implemented the gui for a spline, line and freehand curve, on
xibo.at you can see screenshots. i plan to also add the current polynomial
curve.

now the problem is, that the KisCurveWidget returns a KisCubicCurve.
KisCubicCurve contains the polynomial implementation. If we have four or
more different Curves, then we need a new base class KisCurve and 4
derived classes: KisPolynomialCurve, KisSplineCurve, KisLineCurve and
KisFreehandCurve.

It wouldn't be possible anymore to pass the curve by value, because
the subclasses have to overwrite some methods (for instance the
*transfer(..) ), that in turn means, that we can't keep api compatibility
and we can't replace all curves in one step. So there won't be new curves
in 2.3 most probably :(.

so here is a proposition for a plan on how to move:
o rename KisCubicCurve into KisPolynomialCurve (imo this fits better)
o Create new classes: KisCurve and derived
o Rename KisCurveWidget into KisOldCurveWidget (this would trigger changes
   in many files, but mostly .ui only)
o move the new KisCurveWidget and friends to the parent dir
o Search for KisOldCurveWidget in the code base and look, if something has
   to be done if replacing with KisCurveWidget

The new curve base class (KisCurve) would look very much like the current
KisCubicCurve, but some of the methods would be pure virtual.
The public interface of KisCurveWidget would be also very similar. in fact
only two methods have to be changed:
/**
    * @return get a list with all defined points. If you want to know what
    * the
    * y value for a given x is on the curve defined by these points, use
    * KisCurve::getCurveValue().
    * you must not delete the object returned by this method
    * @see KisCurve::getCurveValue
    */
KisCurve* curve();

/**
    * Replace the current curve with a curve specified by the curve defined
    * by the control
    * points in @param inlist. The curve will be deleted by this class.
    */
void setCurve(KisCurve *curve);


This is only a proposition, I'm open to any comments, hints and criticism.

thanks,
adam


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


More information about the kimageshop mailing list