Add filter plugin
Boudewijn Rempt
boud at valdyas.org
Fri Aug 3 10:52:33 UTC 2012
On Fri, 3 Aug 2012, Daniel Johannsen wrote:
> Hi Krita development team,
>
> i like to add a new filter plugin into Krita. Basically, it is a desaturation filter which preserves luminance information
> when converting from rgb to grayscale. The algorithm constists of a simple linear combination of the rgb values
> in order to derive the gray value.
>
> As a quick (and dirty) feasibility study, i altered the source file LcmsColorSpace.h by overwriting the method call
>
> cmsDoTransform(cmstransform, const_cast<quint8 *>(src), dst, nPixels);
>
> inside the method transform in struct KoLcmsColorTransformation.
>
> While this works and changes the color of the image in the way it supposed to, of course it is far from being
> an incorporation of a new filter plugin into Krita.
>
> Now,
> how do i add a new filter plugin into Krita the right way?
> Is there any documentation which explains how to write a filter plugin? (I found only one Developing Krita Plugins,
> but it seems way out of date.)
>
Yeah, that's very out of date... Basically, when doing a filter you have
two choices: either you can use lcms' color transformations. That is
mostly colorspace independent. That's where you ended up in this case.
However, you can also implement the code right inside the filter plugin.
These are in krita/plugins/filters, where you can find lots of examples.
What you need to do then is to take the incoming pixels, convert them to a
known colorspace (like Lab, for instance), do the algorithm, then convert
it back.
Basically, all you then need to do is implement the process() method.
Boudewijn
More information about the kimageshop
mailing list