From 3d4e3209e60a103f606fa9ee47c2962406330966 Mon Sep 17 00:00:00 2001 From: Ivand Date: Thu, 24 Jul 2025 10:46:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=83=8C=E6=99=AF=E4=BA=9A?= =?UTF-8?q?=E5=85=8B=E5=8A=9B=E6=95=88=E6=9E=9C=E7=B2=97=E7=B3=99=E5=BA=A6?= =?UTF-8?q?=E8=B0=83=E8=8A=82=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BD=86=E6=9C=AA?= =?UTF-8?q?=E5=AE=9E=E8=A3=85=E3=80=82=20=E6=B6=89=E5=8F=8A=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=BF=AE=E6=94=B9=E8=AF=B4=E6=98=8E:=20-=20=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=B1=82=EF=BC=9AISettingsService.cs=E6=96=B0?= =?UTF-8?q?=E5=A2=9ECoverAcrylicEffectAmount=E5=B1=9E=E6=80=A7=20-=20?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=B1=82=EF=BC=9ASettingsService.cs=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E4=BA=9A=E5=85=8B=E5=8A=9B=E6=95=88=E6=9E=9C=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=AD=98=E5=82=A8=20-=20=E8=A7=86=E5=9B=BE=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=EF=BC=9ALyricsRendererViewModel=E7=B3=BB=E5=88=97?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=96=B0=E5=A2=9E=E5=99=AA=E7=82=B9=E8=B4=B4?= =?UTF-8?q?=E5=9B=BE=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91=20-=20=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=A1=B5=E9=9D=A2=EF=BC=9A=E6=96=B0=E5=A2=9ECoverAcry?= =?UTF-8?q?licEffectAmount=E7=BB=91=E5=AE=9A=E5=B1=9E=E6=80=A7=E5=8F=8A?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=9C=BA=E5=88=B6=20-=20=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E8=B5=84=E6=BA=90=EF=BC=9A=E6=96=B0=E5=A2=9E=E5=A4=9A?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E6=94=AF=E6=8C=81=EF=BC=88en-US,=20ja-JP,=20?= =?UTF-8?q?ko-KR,=20zh-CN,=20zh-TW=EF=BC=89=20-=20XAML=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=EF=BC=9ASettingsPage.xaml=E6=96=B0=E5=A2=9E=E8=B0=83=E8=8A=82?= =?UTF-8?q?=E6=BB=91=E5=9D=97=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ivand --- .../Helper/NoiseGenerationHelper.cs | 313 ++++++++++++++++++ .../Services/ISettingsService.cs | 1 + .../Services/SettingsService.cs | 9 + .../Strings/en-US/Resources.resw | 3 + .../Strings/ja-JP/Resources.resw | 3 + .../Strings/ko-KR/Resources.resw | 3 + .../Strings/zh-CN/Resources.resw | 3 + .../Strings/zh-TW/Resources.resw | 3 + .../LyricsRendererViewModel.Ctor.cs | 1 + .../LyricsRendererViewModel.Draw.cs | 35 +- .../LyricsRendererViewModel.Messages.cs | 4 + .../ViewModels/LyricsRendererViewModel.cs | 4 + .../ViewModels/SettingsPageViewModel.cs | 10 + .../Views/SettingsPage.xaml | 18 + 14 files changed, 402 insertions(+), 8 deletions(-) create mode 100644 BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/NoiseGenerationHelper.cs diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/NoiseGenerationHelper.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/NoiseGenerationHelper.cs new file mode 100644 index 0000000..dfaf767 --- /dev/null +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/NoiseGenerationHelper.cs @@ -0,0 +1,313 @@ +using System; +using System.Buffers; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Windows.Storage; +using static BetterLyrics.WinUI3.Helper.NoiseOverlayHelper.BitmapFileCreator; + +namespace BetterLyrics.WinUI3.Helper +{ + internal static class NoiseOverlayHelper + { + + const string NoiseOverlayFileName = "noise_overlay.bmp"; + + static readonly string NoiseOverlayFilePath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "Assets", NoiseOverlayFileName); + + /// + /// 生成单色灰阶随机噪声 + /// + /// 输出文件路径 + /// 图片宽度 + /// 图片高度 + public static async Task GenerateNoiseBitmapAsync(int width, int height) + { + const uint NumOfGrayscale = 16; + uint bitCount = NextPowerOfTwo((uint)Math.Round(Math.Sqrt(NumOfGrayscale))); + + var palette = BitmapFileCreator.CreateGrayscalePalette(16); + var pixelData = await GenerateRandomNoise(width, height, bitCount); + + var fileHeader = BitmapFileCreator.CreateFileHeader(palette, pixelData); + var infoHeader = BitmapFileCreator.CreateInfoHeader(width, height, bitCount); + + return new BitmapFile(fileHeader, infoHeader, palette, pixelData); + } + + /// + /// 读取噪声图片的位头信息 + /// + public static BitmapFileCreator.WINBMPINFOHEADER ReadBitmapInfoHeaders(string? FilePath) + { + var _filePath = FilePath ?? NoiseOverlayFilePath; + using var fs = new FileStream(_filePath, FileMode.Open, FileAccess.Read); + using var br = new BinaryReader(fs); + + // 跳过文件头 + fs.Seek(Marshal.SizeOf(), SeekOrigin.Begin); + + // 读取信息头 + byte[] infoHeaderBytes = br.ReadBytes(Marshal.SizeOf()); + return MemoryMarshal.Read(infoHeaderBytes); + } + + public static BitmapFileCreator.WINBMPINFOHEADER ReadBitmapInfoHeaders(byte[] FileBytes) + { + // 跳过文件头 + var offset = Marshal.SizeOf(); + + // 读取信息头 + var infoHeaderLength = Marshal.SizeOf(); + Span infoHeaderBytes = new(FileBytes, offset, infoHeaderLength); + return MemoryMarshal.Read(infoHeaderBytes); + } + + /// + /// safe 的写入 struct 到流 + /// + /// 值 strcut + /// 要写入的字节流 + /// 要被写入的结构 + public static void WriteStruct(Stream stream, in T structure) where T : struct + { + int size = Unsafe.SizeOf(); + byte[] buffer = ArrayPool.Shared.Rent(size); + try + { + MemoryMarshal.Write(buffer, in structure); + stream.Write(buffer, 0, size); + } + finally + { + ArrayPool.Shared.Return(buffer); + } + } + + /// + /// 随机填充位图内容 + /// + /// 填充宽度 + /// 填充高度 + /// 单个调色盘索引所占比特位数 + /// 字节数据 + private static Task GenerateRandomNoise(int width, int height, uint bitCount) + { + // 创建位图行字节数,4K 对齐 + int rowSize = ((width * (int)bitCount + 31) >> 5) << 2; + + // 创建随机位图数据 + Random rnd = new(); + return Task.Run(() => Enumerable.Range(0, rowSize * height) + .Select(i => (byte)rnd.Next(0x00, 0xFF)) + .ToArray()); + } + + private static uint NextPowerOfTwo(uint value) + { + value--; + value |= value >> 1; + value |= value >> 2; + value |= value >> 4; + value |= value >> 8; + value |= value >> 16; + return value + 1; + } + public static class BitmapFileCreator + { + + /// + /// 创建BMP文件头 + /// + /// 调色盘数据 + /// 像素数据 + /// 文件头结构 + public static BITMAPFILEHEADER CreateFileHeader(byte[] palette, byte[] pixelData) + { + return new BITMAPFILEHEADER + { + bfType = 0x4D42, + bfSize = (uint)(Marshal.SizeOf() + + Marshal.SizeOf() + + palette.Length + + pixelData.Length), + bfReserved1 = 0, + bfReserved2 = 0, + bfOffBits = (uint)(Marshal.SizeOf() + + Marshal.SizeOf() + + palette.Length) + }; + } + + /// + /// 将指定值填充到为最接近的2的幂数 + /// + /// + /// 生成灰阶调色盘 + /// + /// 灰阶数量 + /// 调色盘byte数组 + public static byte[] CreateGrayscalePalette(int colors) + { + return Enumerable.Range(0, colors) + .SelectMany(i => Enumerable.Repeat((byte)(i * 0x10), 4)) + .ToArray(); + } + + /// + /// 创建BMP信息头 + /// + /// 宽度 + /// 高度 + /// 单个像素(调色盘索引)位数 + /// BMP信息头结构 + public static WINBMPINFOHEADER CreateInfoHeader(int width, int height, uint bitCount) + { + return new WINBMPINFOHEADER + { + biSize = (uint)Marshal.SizeOf(), + biWidth = (uint)width, + biHeight = (uint)height, + biPlanes = 1, + biBitCount = (ushort)bitCount, + biCompression = 0, + biSizeImage = 0, + biXPelsPerMeter = 0, + biYPelsPerMeter = 0, + biClrUsed = 0, + biClrImportant = 0 + }; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + /// + /// BMP 位图文件头 + /// + public struct BITMAPFILEHEADER + { + /// + /// 文件类型标识,用于指定文件格式 + /// + public ushort bfType; + /// + /// 文件大小,以字节为单位 + /// + public uint bfSize; + /// + /// 保留字段,未使用 + /// + public ushort bfReserved1; + /// + /// 保留字段,未使用 + /// + public ushort bfReserved2; + /// + /// 像素数据的起始位置,以字节为单位,从文件头开始计算 + /// + public uint bfOffBits; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + /// + /// BMP 位图信息头 + /// + public struct WINBMPINFOHEADER + { + /// + /// 指定此结构体的字节大小。 + /// + public uint biSize; + + /// + /// 以像素为单位的位图宽度。 + /// + public uint biWidth; + + /// + /// 以像素为单位的位图高度。 + /// + public uint biHeight; + + /// + /// 目标设备的平面数,通常为1。 + /// + public ushort biPlanes; + + /// + /// 每个像素的位数,表示颜色深度,如1、4、8、16、24、32等。 + /// + public ushort biBitCount; + + /// + /// 压缩类型,0表示不压缩。 + /// + public uint biCompression; + + /// + /// 位图图像数据的大小(以字节为单位),若图像未压缩,该值可设为0。 + /// + public uint biSizeImage; + + /// + /// 每米X轴方向的像素数(水平分辨率),通常设为0。 + /// + public uint biXPelsPerMeter; + + /// + /// 每米Y轴方向的像素数(垂直分辨率),通常设为0。 + /// + public uint biYPelsPerMeter; + + /// + /// 实际使用的颜色索引数,若为0,则使用位图中实际出现的颜色数。 + /// + public uint biClrUsed; + + /// + /// 重要颜色索引数,0表示所有颜色都重要。 + /// + public uint biClrImportant; + } + } + + public class BitmapFile(BitmapFileCreator.BITMAPFILEHEADER fileHeader, BitmapFileCreator.WINBMPINFOHEADER infoHeader, byte[] palette, byte[] pixelData) + { + public BITMAPFILEHEADER FileHeader = fileHeader; + public WINBMPINFOHEADER InfoHeader = infoHeader; + public byte[] Palette = palette; + public byte[] PixelData = pixelData; + + /// + /// 转换为byte[] + /// + /// + public static explicit operator byte[](BitmapFile bf) + { + var result = new byte[bf.FileHeader.bfSize]; + var ms = new MemoryStream(result); + bf.WriteToStream(ms); + return result; + } + + public byte[] ToByteArray() => (byte[])this; + + public Task ToByteArrayAsync() { return Task.FromResult(ToByteArray());} + + /// + /// 写入此结构到流中 + /// + public void WriteToStream(Stream stream) + { + NoiseOverlayHelper.WriteStruct(stream, FileHeader); + NoiseOverlayHelper.WriteStruct(stream, InfoHeader); + stream.Write(Palette); + stream.Write(PixelData); + stream.Flush(); + } + } + } +} diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/ISettingsService.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/ISettingsService.cs index 0dc5891..5783040 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/ISettingsService.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/ISettingsService.cs @@ -19,6 +19,7 @@ namespace BetterLyrics.WinUI3.Services int CoverOverlayBlurAmount { get; set; } int CoverOverlayOpacity { get; set; } bool IsDynamicCoverOverlayEnabled { get; set; } + int CoverAcrylicEffectAmount { get; set; } bool IsFanLyricsEnabled { get; set; } bool IsFirstRun { get; set; } bool IsLyricsGlowEffectEnabled { get; set; } diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/SettingsService.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/SettingsService.cs index 4c56c96..3818851 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/SettingsService.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/SettingsService.cs @@ -30,6 +30,8 @@ namespace BetterLyrics.WinUI3.Services private const string CoverOverlayOpacityKey = "CoverOverlayOpacity"; private const string IsCoverOverlayEnabledKey = "IsCoverOverlayEnabled"; + private const string CoverAcrylicEffectAmountKey = "CoverAcrylicEffectAmount"; + private const string DesktopWindowLeftKey = "DesktopWindowLeft"; private const string DesktopWindowTopKey = "DesktopWindowTop"; private const string DesktopWindowWidthKey = "DesktopWindowWidth"; @@ -181,6 +183,7 @@ namespace BetterLyrics.WinUI3.Services SetDefault(CoverOverlayOpacityKey, 100); // 100 % = 1.0 SetDefault(CoverOverlayBlurAmountKey, 100); SetDefault(CoverImageRadiusKey, 12); // 12 % + SetDefault(CoverAcrylicEffectAmountKey, 0); // Lyrics SetDefault(LyricsAlignmentTypeKey, (int)TextAlignmentType.Center); SetDefault(SongInfoAlignmentTypeKey, (int)TextAlignmentType.Left); @@ -396,6 +399,12 @@ namespace BetterLyrics.WinUI3.Services set => SetValue(IsDynamicCoverOverlayEnabledKey, value); } + public int CoverAcrylicEffectAmount + { + get => GetValue(CoverAcrylicEffectAmountKey); + set => SetValue(CoverAcrylicEffectAmountKey, value); + } + public bool IsFanLyricsEnabled { get => GetValue(IsFanLyricsEnabledKey); diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw index 0cf8ed1..6725442 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw @@ -796,4 +796,7 @@ 音乐库 + + Acrylic effect roughness + \ No newline at end of file diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw index 98d2e55..255ef03 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw @@ -793,6 +793,9 @@ タイトルバーをページ全体に拡張して、ウィンドウを非対話領域でドラッグできるようにします + + アクリル模倣効果の粗さ + 音楽ギャラリー diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw index 15d5ac8..b7120e8 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw @@ -793,6 +793,9 @@ 비 중과 영역에서 창을 드래그 할 수 있도록 제목 표시 줄을 전체 페이지로 확장하십시오. + + 아크릴 효과 모방 거칠기 + 음악 갤러리 diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw index 0cf8ed1..aca80e3 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw @@ -793,6 +793,9 @@ 将标题栏扩展至整个页面使得在任意非交互区域均可拖拽窗口 + + 仿亚克力效果粗糙度 + 音乐库 diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw index 0d6d360..43b545c 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw @@ -793,6 +793,9 @@ 將標題列擴展至整個頁面使得在任意非互動區域均可拖曳窗口 + + 仿亞克力效果粗糙度 + 音樂庫 diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Ctor.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Ctor.cs index 6de1b17..c889646 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Ctor.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Ctor.cs @@ -21,6 +21,7 @@ namespace BetterLyrics.WinUI3.ViewModels _isDynamicCoverOverlayEnabled = _settingsService.IsDynamicCoverOverlayEnabled; _albumArtBgOpacity = _settingsService.CoverOverlayOpacity; _albumArtBgBlurAmount = _settingsService.CoverOverlayBlurAmount; + _coverAcrylicEffectAmount = _settingsService.CoverAcrylicEffectAmount; _lyricsBgFontColorType = _settingsService.LyricsBgFontColorType; _lyricsFgFontColorType = _settingsService.LyricsFgFontColorType; diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Draw.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Draw.cs index 9da0567..dd520ac 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Draw.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Draw.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Linq; using System.Numerics; using Windows.Foundation; +using Windows.Graphics.Effects; using Windows.UI; namespace BetterLyrics.WinUI3.ViewModels @@ -187,16 +188,34 @@ namespace BetterLyrics.WinUI3.ViewModels DrawBackgroundImgae(control, overlappedCoversDs, _albumArtCanvasBitmap, _albumArtBgTransition.Value); } - using var coverOverlayEffect = new OpacityEffect + IGraphicsEffectSource blurredCover = new GaussianBlurEffect + { + BlurAmount = _albumArtBgBlurAmount, + Source = overlappedCovers, + BorderMode = EffectBorderMode.Soft, + Optimization = EffectOptimization.Speed, + }; + + // 应用亚克力噪点效果 + // TODO: 没有写_coverAcrylicNoiseCanvasBitmap加载的代码 + if (_coverAcrylicEffectAmount > 0 && _coverAcrylicNoiseCanvasBitmap != null) + { + blurredCover = new BlendEffect + { + Mode = BlendEffectMode.SoftLight, + Background = blurredCover, + Foreground = new OpacityEffect + { + Source = _coverAcrylicNoiseCanvasBitmap, + Opacity = _coverAcrylicEffectAmount / 100f, + }, + }; + } + + var coverOverlayEffect = new OpacityEffect { Opacity = _albumArtBgOpacity / 100f, - Source = new GaussianBlurEffect - { - BlurAmount = _albumArtBgBlurAmount, - Source = overlappedCovers, - BorderMode = EffectBorderMode.Soft, - Optimization = EffectOptimization.Speed, - }, + Source = blurredCover, }; ds.DrawImage(coverOverlayEffect); diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Messages.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Messages.cs index 8fb69af..c5fac76 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Messages.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Messages.cs @@ -185,6 +185,10 @@ namespace BetterLyrics.WinUI3.ViewModels { _albumArtBgBlurAmount = message.NewValue; } + else if (message.PropertyName == nameof(SettingsPageViewModel.CoverAcrylicEffectAmount)) + { + _coverAcrylicEffectAmount = message.NewValue; + } else if (message.PropertyName == nameof(SettingsPageViewModel.LyricsVerticalEdgeOpacity)) { _lyricsVerticalEdgeOpacity = message.NewValue; diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.cs index 1ddf9d4..73e04be 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.cs @@ -46,6 +46,8 @@ namespace BetterLyrics.WinUI3.ViewModels private CanvasBitmap? _lastAlbumArtCanvasBitmap = null; private CanvasBitmap? _albumArtCanvasBitmap = null; + private CanvasBitmap? _coverAcrylicNoiseCanvasBitmap = null; + private float _albumArtSize = 0f; private int _albumArtCornerRadius = 0; @@ -185,6 +187,8 @@ namespace BetterLyrics.WinUI3.ViewModels private int _albumArtBgBlurAmount; private int _albumArtBgOpacity; + private int _coverAcrylicEffectAmount; + [ObservableProperty] public partial bool IsTranslating { get; set; } = false; diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/SettingsPageViewModel.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/SettingsPageViewModel.cs index 386ffbe..612425e 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/SettingsPageViewModel.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/SettingsPageViewModel.cs @@ -54,6 +54,8 @@ namespace BetterLyrics.WinUI3.ViewModels CoverOverlayOpacity = _settingsService.CoverOverlayOpacity; CoverOverlayBlurAmount = _settingsService.CoverOverlayBlurAmount; + CoverAcrylicEffectAmount = _settingsService.CoverAcrylicEffectAmount; + LyricsAlignmentType = _settingsService.LyricsAlignmentType; SongInfoAlignmentType = _settingsService.SongInfoAlignmentType; LyricsFontWeight = _settingsService.LyricsFontWeight; @@ -168,6 +170,10 @@ namespace BetterLyrics.WinUI3.ViewModels [NotifyPropertyChangedRecipients] public partial bool IsDynamicCoverOverlayEnabled { get; set; } + [ObservableProperty] + [NotifyPropertyChangedRecipients] + public partial int CoverAcrylicEffectAmount { get; set; } + [ObservableProperty] public partial Enums.Language Language { get; set; } @@ -574,6 +580,10 @@ namespace BetterLyrics.WinUI3.ViewModels { _settingsService.CoverOverlayBlurAmount = value; } + partial void OnCoverAcrylicEffectAmountChanged(int value) + { + _settingsService.CoverAcrylicEffectAmount = value; + } partial void OnCoverOverlayOpacityChanged(int value) { _settingsService.CoverOverlayOpacity = value; diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml index f0cb9df..24e3867 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml @@ -277,6 +277,24 @@ + + + + + + + +