terminal/src/cascadia/TerminalSettingsModel/Profile.idl
Mike Griese b140299e50
Implement user-specified pixel shaders, redux (#8565)
Co-authored-by: mrange <marten_range@hotmail.com>

I loved the pixel shaders in #7058, but that PR needed a bit of polish
to be ready for ingestion. This PR is almost _exactly_ that PR, with
some small changes.

* It adds a new pre-profile setting `"experimental.pixelShaderPath"`,
  which lets the user set a pixel shader to use with the Terminal.
    - CHANGED FROM #7058: It does _not_ add any built-in shaders.
    - CHANGED FROM #7058: it will _override_
      `experimental.retroTerminalEffect`
* It adds a bunch of sample shaders in `samples/shaders`. Included: 
    - A NOP shader as a base to build from.
    - An "invert" shader that inverts the colors, as a simple example
    - An "grayscale" shader that converts all colors to grayscale, as a
      simple example
    - An "raster bars" shader that draws some colored bars on the screen
      with a drop shadow, as a more involved example
    - The original retro terminal effects, as a more involved example
    - It also includes a broken shader, as an example of what heppens
      when the shader fails to compile
    - CHANGED FROM #7058: It does _not_ add the "retroII" shader we were
      all worried about.
* When a shader fails to be found or fails to compile, we'll display an
  error dialog to the user with a relevant error message.
    - CHANGED FROM #7058: Originally, #7058 would display "error bars"
      on the screen. I've removed that, and had the Terminal disable the
      shader entirely then.
* Renames the `toggleRetroEffect` action to `toggleShaderEffect`.
  (`toggleRetroEffect` is now an alias to `toggleShaderEffect`). This
  action will turn the shader OR the retro effects on/off. 

`toggleShaderEffect` works the way you'd expect it to, but the mental
math on _how_ is a little weird. The logic is basically:

```
useShader = shaderEffectsEnabled ? 
                (pixelShaderProvided ? 
                    pixelShader : 
                    (retroEffectEnabled ? 
                        retroEffect : null
                    )
                ) : 
                null
```

and `toggleShaderEffect` toggles `shaderEffectsEnabled`.

* If you've got both a shader and retro enabled, `toggleShaderEffect`
  will toggle between the shader on/off.
* If you've got a shader and retro disabled, `toggleShaderEffect` will
  toggle between the shader on/off.

References #6191
References #7058

Closes #7013

Closes #3930 "Add setting to retro terminal shader to control blur
radius, color" 
Closes #3929 "Add setting to retro terminal shader to enable drawing
scanlines" 
     - At this point, just roll your own version of the shader.
2020-12-15 20:40:22 +00:00

195 lines
5.2 KiB
Plaintext

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
namespace Microsoft.Terminal.Settings.Model
{
enum CloseOnExitMode
{
Never = 0,
Graceful,
Always
};
[flags]
enum BellStyle
{
Audible = 0x1,
Visual = 0x2,
All = 0xffffffff
};
[flags]
enum ConvergedAlignment {
// low 4 bits are the horizontal
Horizontal_Center = 0x00,
Horizontal_Left = 0x01,
Horizontal_Right = 0x02,
// high 4 bits are the vertical
Vertical_Center = 0x00,
Vertical_Top = 0x10,
Vertical_Bottom = 0x20
};
[default_interface] runtimeclass Profile {
Profile();
Profile(Guid guid);
Boolean HasName();
void ClearName();
String Name;
Boolean HasGuid();
Guid Guid;
Boolean HasSource();
void ClearSource();
String Source;
Boolean HasConnectionType();
Guid ConnectionType;
Boolean HasHidden();
void ClearHidden();
Boolean Hidden;
Boolean HasIcon();
void ClearIcon();
String Icon;
Boolean HasCloseOnExit();
void ClearCloseOnExit();
CloseOnExitMode CloseOnExit;
Boolean HasTabTitle();
void ClearTabTitle();
String TabTitle;
Boolean HasTabColor();
void ClearTabColor();
Windows.Foundation.IReference<Windows.UI.Color> TabColor;
Boolean HasSuppressApplicationTitle();
void ClearSuppressApplicationTitle();
Boolean SuppressApplicationTitle;
Boolean HasUseAcrylic();
void ClearUseAcrylic();
Boolean UseAcrylic;
Boolean HasAcrylicOpacity();
void ClearAcrylicOpacity();
Double AcrylicOpacity;
Boolean HasScrollState();
void ClearScrollState();
Microsoft.Terminal.TerminalControl.ScrollbarState ScrollState;
Boolean HasFontFace();
void ClearFontFace();
String FontFace;
Boolean HasFontSize();
void ClearFontSize();
Int32 FontSize;
Boolean HasFontWeight();
void ClearFontWeight();
Windows.UI.Text.FontWeight FontWeight;
Boolean HasPadding();
void ClearPadding();
String Padding;
Boolean HasCommandline();
void ClearCommandline();
String Commandline;
Boolean HasStartingDirectory();
void ClearStartingDirectory();
String StartingDirectory;
String EvaluatedStartingDirectory { get; };
Boolean HasBackgroundImagePath();
void ClearBackgroundImagePath();
String BackgroundImagePath;
String ExpandedBackgroundImagePath { get; };
Boolean HasBackgroundImageOpacity();
void ClearBackgroundImageOpacity();
Double BackgroundImageOpacity;
Boolean HasBackgroundImageStretchMode();
void ClearBackgroundImageStretchMode();
Windows.UI.Xaml.Media.Stretch BackgroundImageStretchMode;
Boolean HasBackgroundImageAlignment();
void ClearBackgroundImageAlignment();
ConvergedAlignment BackgroundImageAlignment;
Boolean HasAntialiasingMode();
void ClearAntialiasingMode();
Microsoft.Terminal.TerminalControl.TextAntialiasingMode AntialiasingMode;
Boolean HasRetroTerminalEffect();
void ClearRetroTerminalEffect();
Boolean RetroTerminalEffect;
Boolean HasPixelShaderPath();
void ClearPixelShaderPath();
String PixelShaderPath;
Boolean HasForceFullRepaintRendering();
void ClearForceFullRepaintRendering();
Boolean ForceFullRepaintRendering;
Boolean HasSoftwareRendering();
void ClearSoftwareRendering();
Boolean SoftwareRendering;
Boolean HasColorSchemeName();
void ClearColorSchemeName();
String ColorSchemeName;
Boolean HasForeground();
void ClearForeground();
Windows.Foundation.IReference<Windows.UI.Color> Foreground;
Boolean HasBackground();
void ClearBackground();
Windows.Foundation.IReference<Windows.UI.Color> Background;
Boolean HasSelectionBackground();
void ClearSelectionBackground();
Windows.Foundation.IReference<Windows.UI.Color> SelectionBackground;
Boolean HasCursorColor();
void ClearCursorColor();
Windows.Foundation.IReference<Windows.UI.Color> CursorColor;
Boolean HasHistorySize();
void ClearHistorySize();
Int32 HistorySize;
Boolean HasSnapOnInput();
void ClearSnapOnInput();
Boolean SnapOnInput;
Boolean HasAltGrAliasing();
void ClearAltGrAliasing();
Boolean AltGrAliasing;
Boolean HasCursorShape();
void ClearCursorShape();
Microsoft.Terminal.TerminalControl.CursorStyle CursorShape;
Boolean HasCursorHeight();
void ClearCursorHeight();
UInt32 CursorHeight;
Boolean HasBellStyle();
void ClearBellStyle();
BellStyle BellStyle;
}
}