====== The New Filter architecture ====== ===== Implementing a New-Style Filter ===== === Tips === * If the filter has multiple instances (e.g. //Texture contrast I// and //II// on the //Lab Color/Contrast// tab) with different configurations (slider ranges, default values, …) see //ptFilter_LocalContrastStretch// and //ptFilter_TextureContrast// as examples for how to implement that. * If your filter arguments depend on the image’s scale factor see the same two classes as examples. Note that the current state of affairs is a kludge and not a proper solution. But it will last until the redesign of ptProcessor. ===== Porting Old-style Filters ===== - Code the new filter as a class derived from //ptFilterBase//. - Create a new FUID entry in //ptFilterUids.h//. Order there is only for readability. Actually FUIDs for most of the filters are already there. In that case you only need to remove the “not yet ported” comment. - Add the new filter to //CreateAllFilters()// in ptMain starting around line 300. Order there is only for readability. - //ptSettings// * Remove old config lines from the lists in the constructor. * Remove the filter’s //if// branch(es) from //ToolInfo()//. * Check //ToolAlwaysVisible()// for the old name and remove. - //ptFilterDM:// Enter the new config item IDs to //FillNameMap()//. The old names are probably there already and are commented out. - //ptMain:// Remove old callbacks (//CB_old-config-name()// functions) and dispatcher macros in //CB_InputChanged()//. - //ptMainWindow:// If the old filter has buttons look for and remove //M_ConnectSomeButton// macros and associated callbacks. Also check for other non-standard widgets and their backend code. - //ptMainWindow.ui// * Find the old filter’s toolbox and delete all the widgets inside it (including the stretcher and top-level widget. Only the toolbox header must remain). * Change the toolbox caption (//currentItemText//) to the FUID and untick the //translatable// checkbox. - //ptProcessor::Run():// Change the call to the old filter to the new one, like this: hFilter = GFilterDM->GetFilterFromName(Fuid::NEWFILTERNAME); if (hFilter->isActive()) { m_ReportProgress(hFilter->caption()); hFilter->runFilter(m_Image_AfterSOMETHING); } * Beware the //Camera// and //Output// tabs! Those are special cases.