C# Win2D效果,仅当内容不是';还没有?

C# Win2D效果,仅当内容不是';还没有?,c#,xaml,uwp,windows-10,win2d,C#,Xaml,Uwp,Windows 10,Win2d,我正在使用一些Win2D特效,我很难找到一种合适的方法使我的UI内容足够暗,这样上面的文本就可以很容易地阅读 现在这是我代码的一部分: ArithmeticCompositeEffect composite = new ArithmeticCompositeEffect { MultiplyAmount = 0, Source1Amount = 0.2f, Source2Amount = 0.8f, // The Source1 parameter will be

我正在使用一些Win2D特效,我很难找到一种合适的方法使我的UI内容足够暗,这样上面的文本就可以很容易地阅读

现在这是我代码的一部分:

ArithmeticCompositeEffect composite = new ArithmeticCompositeEffect
{
    MultiplyAmount = 0,
    Source1Amount = 0.2f,
    Source2Amount = 0.8f,
    // The Source1 parameter will be assigned later on with the EffectFactory
    Source1 = new CompositionEffectSourceParameter(nameof(myBackground)),
    Source2 = new ColorSourceEffect { Color = Colors.Black }
};
因此,我将我的内容(Source1)与统一的黑色混合,这实际上使整个内容更暗。但我有一个问题:

  • 这使得深色内容太暗,而浅色内容不够暗
我听说可以使用模式设置为
BlendEffectMode.Exclusion
来解决这个问题,但我不知道如何正确设置。我试着用这个效果把我的第一个效果和一个统一的黑色结合起来,但是结果没有改变

所以我的问题是:

我可以应用哪种Win2D效果(如果这不是正确的选择,则不一定是排除混合)来确保我的内容始终比给定的阈值(足够暗)暗,而不使已经暗的内容实际上是黑色的


谢谢你的帮助

我发现,使用
亮度到alphaefect
Win2D效果并将生成的贴图覆盖在原始效果上(可能具有一定的强度,以便根据情况使原始图像或多或少变暗)可以解决此问题

例如:

LuminanceToAlphaEffect alphaEffect = new LuminanceToAlphaEffect 
{ 
    Source = new CompositionEffectSourceParameter(nameof(myBackground))
};
ArithmeticCompositeEffect composite = new ArithmeticCompositeEffect
{
    MultiplyAmount = 0,
    Source1Amount = 1 - intensity, // Intensity is in the [0..1] range
    Source2Amount = intensity,
    // The Source1 parameter will be assigned later on with the EffectFactory
    Source1 = new CompositionEffectSourceParameter(nameof(myBackground)),
    Source2 = alphaEffect    
};