The New Filter architecture

Implementing a New-Style Filter


  • 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

  1. Code the new filter as a class derived from ptFilterBase.
  2. 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.
  3. Add the new filter to CreateAllFilters() in ptMain starting around line 300. Order there is only for readability.
  4. 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.
  5. ptFilterDM: Enter the new config item IDs to FillNameMap(). The old names are probably there already and are commented out.
  6. ptMain: Remove old callbacks (CB_old-config-name() functions) and dispatcher macros in CB_InputChanged().
  7. 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.
  8. 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.
  9. ptProcessor::Run(): Change the call to the old filter to the new one, like this:
    hFilter = GFilterDM->GetFilterFromName(Fuid::NEWFILTERNAME);
    if (hFilter->isActive()) {
    • Beware the Camera and Output tabs! Those are special cases.