<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 03.08.2012 12:52, Boudewijn Rempt
wrote:<br>
</div>
<blockquote
cite="mid:alpine.LNX.2.00.1208031244020.27305@calcifer.valdyas.org"
type="cite">On Fri, 3 Aug 2012, Daniel Johannsen wrote:
<br>
<br>
<blockquote type="cite">Hi Krita development team,
<br>
<br>
i like to add a new filter plugin into Krita. Basically, it is a
desaturation filter which preserves luminance information
<br>
when converting from rgb to grayscale. The algorithm constists
of a simple linear combination of the rgb values
<br>
in order to derive the gray value.
<br>
<br>
As a quick (and dirty) feasibility study, i altered the source
file LcmsColorSpace.h by overwriting the method call
<br>
<br>
cmsDoTransform(cmstransform, const_cast<quint8 *>(src),
dst, nPixels);
<br>
<br>
inside the method transform in struct KoLcmsColorTransformation.
<br>
<br>
While this works and changes the color of the image in the way
it supposed to, of course it is far from being
<br>
an incorporation of a new filter plugin into Krita.
<br>
<br>
Now,
<br>
how do i add a new filter plugin into Krita the right way?
<br>
Is there any documentation which explains how to write a filter
plugin? (I found only one Developing Krita Plugins,
<br>
but it seems way out of date.)
<br>
<br>
</blockquote>
<br>
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.
<br>
<br>
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.
<br>
<br>
Basically, all you then need to do is implement the process()
method.
<br>
<br>
Boudewijn
<br>
_______________________________________________
<br>
kimageshop mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:kimageshop@kde.org">kimageshop@kde.org</a>
<br>
<a class="moz-txt-link-freetext" href="https://mail.kde.org/mailman/listinfo/kimageshop">https://mail.kde.org/mailman/listinfo/kimageshop</a>
<br>
<br>
</blockquote>
Thank you very much for your fast answer!<br>
I will start by defining a new process() method and take a look at
the examples on how to create proper menu entries.<br>
<br>
Motivation comes from the importance of luminance information in
paintings (ref. M. Livingstone).<br>
Let me suggest for future versions to extend the existing
desaturation filter in order to be able to choose among several<br>
color-to-gray transformation algorithms ( e.g. luminance or
luminosity in gimp, average, etc. ).<br>
<br>
By the way, when invoking the desaturate filter in calligra version
2.4.2, there is repeatedly the message on stdout:<br>
<i>krita(12176)/koffice: Lcms2 error: 12 Malformed struct in type
'desc' for tag 'dmnd'</i>.<br>
Since the filter works, it is not a big issue.<br>
<br>
Congratulations and thank you very much for this fantastic painting
program.<br>
Daniel<br>
</body>
</html>