Skip to content

Fixes to KisColorTransformationConfiguration related filters

The multichannel filter (inherited by the curves and cross channel filter) uses member variables to store the curves instead of the QVariant properties of the KisPropertiesConfiguration. This makes it impossible to read/write the options through those properties, for example from python side.

This patch just intercepts the functions that set/get properties and transform the stored KisCubicCurve objects to/from string representation to avoid changing the mechanics of the whole filter configuration.

One can test that this works via python with the following steps:

  • Create a paint layer and paint something on it.
  • Create a curves filter layer on top. Select the filter layer.
  • Open scripter and run the following code:
    doc = Krita.instance().activeDocument()
    
    print(doc.activeNode().filter().configuration().properties())
    print(doc.activeNode().filter().configuration().property("curve2"))
    doc.activeNode().filter().configuration().setProperty("curve2", "0,0;0.5,0.25;1,1")
    print(doc.activeNode().filter().configuration().property("curve2"))
    
    doc.refreshProjection()
  • Make sure that the printed parameters are correct.

NOTE: Running the previous code multiple times shows that the image is not updated every time, although the curves are updated correctly. I think it is an issue in KisColorTransformationConfiguration, which the multichannel filter inherits from. I think the issue has to be with the caching of the transformations. In KisColorTransformationConfiguration::colorTransformation if I change the code to avoid the caching it seems to update always:

KoColorTransformation* KisColorTransformationConfiguration::colorTransformation(const KoColorSpace *cs, const KisColorTransformationFilter *filter) const
{
    QMutexLocker locker(&d->mutex);
    KisFilterConfigurationSP config(const_cast<KisColorTransformationConfiguration*>(this));
    KoColorTransformation *transformation = filter->createTransformation(cs, config);
    d->colorTransformation.insert(QThread::currentThread(), transformation);
    locker.unlock();
    return transformation;
}

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.

Merge request reports

Loading