mirror of
https://github.com/jayfunc/BetterLyrics.git
synced 2026-01-12 19:08:33 +08:00
28 lines
824 B
C#
28 lines
824 B
C#
using Microsoft.Graphics.Canvas;
|
|
using Microsoft.Graphics.Canvas.Effects;
|
|
using System;
|
|
using Windows.Graphics.Effects;
|
|
using Windows.UI;
|
|
|
|
namespace BetterLyrics.WinUI3.Helper
|
|
{
|
|
public class CanvasHelper
|
|
{
|
|
public static ShadowEffect CreateForegroundShadowEffect(CanvasCommandList foregroundFontEffect, IGraphicsEffectSource mask, Color shadowColor, double shadowAmount)
|
|
{
|
|
return new ShadowEffect
|
|
{
|
|
Source = new AlphaMaskEffect
|
|
{
|
|
Source = foregroundFontEffect,
|
|
AlphaMask = mask,
|
|
},
|
|
ShadowColor = shadowColor,
|
|
BlurAmount = (float)Math.Clamp(shadowAmount, 0, 100),
|
|
Optimization = EffectOptimization.Speed,
|
|
};
|
|
}
|
|
|
|
}
|
|
}
|