Skip to content

BaseEffect Reference

Cameron White edited this page Apr 20, 2023 · 5 revisions

The BaseEffect class provides several methods that can be used to specify how your effect should be presented to the user.

Name

This specifies the name of the effect, and is used in the Adjustments/Effects menu and in the History pad. This property is abstract, so every effect must implement it:

public override string Name {
    get { return AddinManager.CurrentLocalizer.GetString ("My Effect"); }
}

Icon

This specifies the name of the effect's icon, which is used in the Adjustments/Effects menu and in the History pad. If this property is not overriden, a default icon will be provided. In order for Pinta to be able to load the icon, you should add the image to your project as an EmbeddedResource and then add it to the GTK icon set:

public class MyEffect : BaseEffect
{
    static MyEffect () {
        Gtk.IconFactory factory = new Gtk.IconFactory ();
        factory.Add ("MyEffect.MyIcon.png", new Gtk.IconSet (Gdk.Pixbuf.LoadFromResource ("MyEffect.MyIcon.png")));
        factory.AddDefault ();
    }

    public override string Icon {
        get { return "MyEffect.MyIcon.png"; }
    }
}

EffectMenuCategory

This specifies the category under the "Effects" menu that the effect will be placed in. The default category is "General", and this property does not affect Adjustments.

Pinta ships with the following default categories:

  • Artistic
  • Blurs
  • Distort
  • Noise
  • Photo
  • Render
  • Stylize

It is highly recommended that you use one of the predefined categories:

public override string EffectMenuCategory {
    get { return AddinManager.CurrentLocalizer.GetString ("Stylize"); }
}

AdjustmentMenuKey

This specifies the keyboard shortcut for an adjustment, and is not used for effects. By default, adjustments do not have a shortcut, but you can override this property to specify a shortcut:

public override string? AdjustmentMenuKey => "K";

AdjustmentMenuKeyModifiers

This specifies the modifiers for an adjustment's keyboard shortcut, and is not used for effects. By default, the modifiers are <Primary>+<Shift>, where <Primary> is the Cmd key on macOS and the Ctrl key on other platforms, but you can override this property to specify a different modifier:

public override string AdjustmentMenuKeyModifiers => "<Primary>";