<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;">On Monday 09 March 2009, Dmitry Kazakov wrote:<br>
&gt; &gt;  &gt; The first issue is toXML/toLegacyXML stuff. These functions are<br>
&gt; &gt;<br>
&gt; &gt; implemented<br>
&gt; &gt;<br>
&gt; &gt; &gt; in _different_ classes although they do the same things. More than<br>
&gt; &gt; &gt; that, both of them are called from different parts of krita: bookmark<br>
&gt; &gt; &gt; manager uses toXML, kis_kra_ uses toLegacyXML Why not have the only<br>
&gt; &gt; &gt; one? The only united interface?<br>
&gt; &gt;<br>
&gt; &gt; .kra file are expected to use the toLegacyXML because this functions<br>
&gt; &gt; saves to an XML formated for the 1.6 .kra files. While toXML use the<br>
&gt; &gt; OpenRaster style, described in<br>
&gt; &gt; http://create.freedesktop.org/wiki/index.php?title=OpenRaster/Layers_Stac<br>
&gt; &gt;k_Specification.<br>
&gt;<br>
&gt; Do you mean filter's configuration should look like that?<br>
&gt;<br>
&gt; &lt;filter name="perchannel" type="applications:Krita:PerChannel"&gt;<br>
&gt;      &lt;params version=1&gt;<br>
&gt;        &lt;param name="CurvesNumber"&gt;3&lt;/param&gt;<br>
&gt;        &lt;param name="curve0"&gt;0,0;0.5,0.5;1,1;&lt;/param&gt;<br>
&gt;        &lt;param name="curve1"&gt;0,0;1,1;&lt;/param&gt;<br>
&gt;        &lt;param name="curve2"&gt;0,0;1,1;&lt;/param&gt;<br>
&gt;      &lt;/params&gt;<br>
&gt; &lt;/filter&gt;<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Yes.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>&gt;<br>
&gt;  even if it will be very inspired by the SVG spec.<br>
&gt;<br>
&gt;<br>
&gt; I'm afraid we can't be inspired by SVGspec here at all. The point is they<br>
&gt; suggest us to use linear interpolation for the curve (i guess this type of<br>
&gt; the curve had been implemented in KCurve before my patch) . Maybe this type<br>
&gt; is a good idea for some ideal theoretical curve as it's quite simple and<br>
&gt; fast, but for real users (who are "inspired" by real professional<br>
&gt; instrumens, such as PS, PictureWindowPro, TheGimp) it's at least _strange_<br>
&gt; curve and almost unusable, because they are used to cubic splines.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Difference between inspiration and copy/paste is that you can make changes ;) I have no objection to adding cubic splines to the list of types, and to properly specify it.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>&gt; Of course, we can interpolate cubic spline, drawn by the user, to the<br>
&gt; linear one and write the latter to the file in SVG format. But the user<br>
&gt; won't be able to change the curve later.<br>
&gt;<br>
&gt; And the last issue against SVG. SVG's feComponentTransferis is stuck to<br>
&gt; RGB. RGB is not the only colorspace in the world. ;)<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Well you have shown one of the solution to that problem in the beginning of the mail ;) While I am not a fan of numbers, it might as well be better to have curve_red, curve_blue, curve_cyan, curve_l, curve_...<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>&gt; &gt; &gt; KisBaseProcessor::defaultConfiguration(const KisPaintDeviceSP pd)<br>
&gt; &gt;<br>
&gt; &gt; The documentation says all.<br>
&gt;<br>
&gt; Where can i take a look on this documentation?<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>In the header, or http://www.koffice.org/developer/apidocs/ (more specificly http://www.koffice.org/developer/apidocs/krita-image/classKisBaseProcessor.html#09a63a0fbbf406ccddd0409fe2644e77 )<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>&gt; &gt; It's the configuration that will be used in the filter dialog when the<br>
&gt; &gt; user start the dialog.<br>
&gt; &gt;<br>
&gt; &gt; You forgot that way as well:<br>
&gt; &gt; KisFilterConfiguration * KisBaseProcessor::factoryConfiguration(const<br>
&gt; &gt; KisPaintDeviceSP) const<br>
&gt; &gt; whose name sucks and is a bit confusing (if anyone has a better idea,<br>
&gt;<br>
&gt; createConfiguration?<br>
I think it's a too generic name.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>&gt; &gt; Filter configurations are saved in KisBookmarkedConfigurationManager<br>
&gt; &gt; which is a generic class which can be used with all kind of<br>
&gt; &gt; KisSerializableConfiguration to store them, this can be<br>
&gt; &gt; filters/generators configuration, paintop settings, ... The only way<br>
&gt; &gt; KisBookmarkedConfigurationManager can create the correct subclass of<br>
&gt; &gt; KisSerializableConfiguration is by using the<br>
&gt; &gt; KisFilterConfigurationFactory.<br>
&gt;<br>
&gt; The problem is that KisKraLoader::loadAdjustmentLayer calls<br>
&gt; KisBaseProcessor::defaultConfiguration(...). The latter one calls<br>
&gt; factoryConfiguration and (if factoryConfiguration isn't overridden in<br>
&gt; KisPerChannelFilter) creates KisFilterConfiguration instead of needed<br>
&gt; KisPerChannelFilterConfiguration. This causes adjustment layers not being<br>
&gt; loaded properly from .kra.<br>
&gt;<br>
&gt; The easiest (and the most illogical) workaround is to change<br>
&gt; KisBookmarkedConfigurationManager::defaultConfiguration, that has access to<br>
&gt; filter's configurationFactory, to call factory's createDefault if nothing<br>
&gt; can be loaded from kritarc.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Why not provide an implementation of KisBaseProcessor::factoryConfiguration in  KisPerChannelFilter ?<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>&gt; KisSerializableConfiguration*<br>
&gt; KisBookmarkedConfigurationManager::defaultConfiguration() const<br>
&gt; {<br>
&gt;     if (exists(KisBookmarkedConfigurationManager::ConfigDefault.id())) {<br>
&gt;         return load(KisBookmarkedConfigurationManager::ConfigDefault.id());<br>
&gt;     }<br>
&gt; ///skipped///<br>
&gt;     return d-&gt;configFactory-&gt;createDefault();<br>
&gt; }<br>
&gt;<br>
&gt; In this case we won't need factoryDefault at all. But this change is _very<br>
&gt; bad idea_ as it's illogical.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Yes. Not good.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>&gt; In my opinion Factories should somehow call Filter's defaultConfiguration<br>
&gt; instead of having their own createDefault and create(...). In this case,<br>
&gt; maybe, we won't even be needed to override KisConfigurationFactory for<br>
&gt; every filter.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Except defaultConfiguration it will break the purpose of defaultConfiguration, and will trigger an endless loop, since KisFilter::defaultConfiguration() call the BookmarkManager to get the configuration which will then call the factory. But it might be a good idea to use KisBaseProcessor::factoryConfiguration for that, instead.<br>
The main advantages, would be that there would, indeed, be no more need for overriding KisConfigurationFactory, and if the filter get new parameters they are loaded from the factoryConfiguration. And I can't see a drawback.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>-- <br>
Cyrille Berger</p></body></html>