Back Home Table of Contents

Creating your UI

There are several ways to create a UI for your filter.

Simple

The Simple UI is the recommended way to create your filter. Since most filters have only a few parameters and those parameters are typically numbers, booleans, or a limited list of options, the Simple UI allows you to quickly describe those parameters and lets the host take care of all of the complicated UI logic. As an added bonus, your filter will automatically get the latest and greatest UI updates without needing any more work on your part.

A Simple UI is defined in a .json file. Configure your extension.ini file as follows.

[UI]
Type = "Simple"
Definition = "UI.json"

See the Simple UI Reference for more information about all of the available directives.

WinForms

If the Simple UI isn't enough, you can create a custom UI using WinForms. You can utilize some of the same Simple UI controls (such as ValueSlider) from NPSShared.dll but you are free to use any controls you want. See the sample code for some examples of what you can do.

A WinForms UI is part of your DLL. Create a user control that implements INPSFormsUI and then configure your extension.ini file as follows:

[UI]
Type = "WinForms"
Definition = "$auto$"

You can also explicitly specify the class name instead of $auto$ if you don't want to rely on the autoloader, such as if you have multiple INPSFormsUI objects within your DLL.

Fully Custom

By hiding the preview and channel picker, you have nearly unlimited customization potential for your form and can utilize the FormsHost to help you generate filter previews from scratch. See the FullyCustomSample for an example of this.

None

If your filter has no configurable parameters, you can set Type = "None". No UI will be displayed, other than a possible confirmation dialog provided by the host.

This is not the same thing as Silent Mode (which all extensions must support) but works similarly in the sense that no UI is presented to the user.

Standard UI Features

The extension host provides standard features that can be turned on or off for your particular filter depending on relevance.

Channel picker

The channel picker allows the user to specify red, green, blue, and (optionally) alpha channels to apply the filter to. These automatically set the Channel.Red, Channel.Green, Channel.Blue, and Channel.Alpha parameters. This is a useful feature for various adjustments like brightness, contrast, or even blur; however it's not appropriate for all types of filters such as those relying on a specific color or mixing channels in a different color space.

You can disable the entire channel picker by setting HideChannelPicker = true or only disable the alpha channel selection (still allowing red/green/blue) by setting DisableAlphaChannelPicker = true.

Reset button

The Reset button will reset all parameters to the default values you specify in your code. This is not always appropriate for all filters so you can set HideResetButton = true.

Preview

The preview will update in real time as you adjust filter parameters (depending on the user's setting). You can either preview a zoomed-out version of the image or a panned actual-size clipping.

A fixed preview prevents the user from panning around the image and only displays the whole image. This can be useful for filters that render on top of the entire image or where a clipped preview cannot be easily rendered. To force a fixed preview, set FixedPreview = true.

You can also completely disable the preview, freeing up space for a fully custom UI, by setting HidePreview = true.