mirror of
https://github.com/jayfunc/BetterLyrics.git
synced 2026-01-13 03:34:55 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a831b17cc | ||
|
|
78076efe40 | ||
|
|
d0346bf422 |
@@ -12,7 +12,7 @@
|
||||
<Identity
|
||||
Name="37412.BetterLyrics"
|
||||
Publisher="CN=E1428B0E-DC1D-4EA4-ACB1-4556569D5BA9"
|
||||
Version="1.0.79.0" />
|
||||
Version="1.0.81.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="ca4a4830-fc19-40d9-b823-53e2bff3d816" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
|
||||
@@ -291,13 +291,15 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Top :
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Bottom - _liveStatesService.LiveStates.LyricsWindowStatus.DockHeight;
|
||||
|
||||
y -= 1;
|
||||
|
||||
User32.SetWindowPos(
|
||||
hwnd,
|
||||
IntPtr.Zero,
|
||||
(int)_liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Left,
|
||||
(int)y,
|
||||
(int)_liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Width,
|
||||
(int)_liveStatesService.LiveStates.LyricsWindowStatus.DockHeight,
|
||||
(int)_liveStatesService.LiveStates.LyricsWindowStatus.DockHeight + 1,
|
||||
User32.SetWindowPosFlags.SWP_SHOWWINDOW
|
||||
);
|
||||
}
|
||||
@@ -309,7 +311,7 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
var uEdge = _liveStatesService.LiveStates.LyricsWindowStatus.DockPlacement == DockPlacement.Top ? Shell32.ABE.ABE_TOP : Shell32.ABE.ABE_BOTTOM;
|
||||
|
||||
double top = _liveStatesService.LiveStates.LyricsWindowStatus.DockPlacement == DockPlacement.Top ? _liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Top : _liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Bottom - _liveStatesService.LiveStates.LyricsWindowStatus.DockHeight;
|
||||
double bottom = _liveStatesService.LiveStates.LyricsWindowStatus.DockPlacement == DockPlacement.Top ? _liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Top + _liveStatesService.LiveStates.LyricsWindowStatus.DockHeight : _liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Bottom;
|
||||
double bottom = top + _liveStatesService.LiveStates.LyricsWindowStatus.DockHeight;
|
||||
|
||||
Shell32.APPBARDATA abd = new()
|
||||
{
|
||||
@@ -366,9 +368,7 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Top :
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Bottom - _liveStatesService.LiveStates.LyricsWindowStatus.DockHeight;
|
||||
|
||||
double bottom = _liveStatesService.LiveStates.LyricsWindowStatus.DockPlacement == DockPlacement.Top ?
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Top + _liveStatesService.LiveStates.LyricsWindowStatus.DockHeight :
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Bottom;
|
||||
double bottom = top + _liveStatesService.LiveStates.LyricsWindowStatus.DockHeight;
|
||||
|
||||
Shell32.APPBARDATA abd = new()
|
||||
{
|
||||
@@ -392,9 +392,9 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
hwnd,
|
||||
IntPtr.Zero,
|
||||
(int)_liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Left,
|
||||
(int)top,
|
||||
(int)top - 1,
|
||||
(int)_liveStatesService.LiveStates.LyricsWindowStatus.MonitorBounds.Width,
|
||||
(int)_liveStatesService.LiveStates.LyricsWindowStatus.DockHeight,
|
||||
(int)_liveStatesService.LiveStates.LyricsWindowStatus.DockHeight + 1,
|
||||
User32.SetWindowPosFlags.SWP_SHOWWINDOW
|
||||
);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace BetterLyrics.WinUI3.Renderer
|
||||
|
||||
private async void LyricsCanvas_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
|
||||
{
|
||||
await ViewModel.CreateResourcesAsync();
|
||||
await ViewModel.CreateResourcesAsync(sender);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using BetterLyrics.WinUI3.Helper;
|
||||
using CommunityToolkit.WinUI;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Effects;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -16,12 +19,18 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
{
|
||||
private PixelShaderEffect? _effect;
|
||||
|
||||
public async Task CreateResourcesAsync()
|
||||
public async Task CreateResourcesAsync(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl control)
|
||||
{
|
||||
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/effect.bin"));
|
||||
IBuffer buffer = await FileIO.ReadBufferAsync(file);
|
||||
var bytes = buffer.ToArray();
|
||||
_effect = new PixelShaderEffect(bytes);
|
||||
_effect.Properties["Width"] = Convert.ToSingle(control.ConvertDipsToPixels((float)control.Size.Width, CanvasDpiRounding.Round));
|
||||
_effect.Properties["Height"] = Convert.ToSingle(control.ConvertDipsToPixels((float)control.Size.Height, CanvasDpiRounding.Round));
|
||||
_effect.Properties["color1"] = Colors.Black.ToVector3RGB();
|
||||
_effect.Properties["color2"] = Colors.Black.ToVector3RGB();
|
||||
_effect.Properties["color3"] = Colors.Black.ToVector3RGB();
|
||||
_effect.Properties["color4"] = Colors.Black.ToVector3RGB();
|
||||
_effect.Properties["EnableLightWave"] = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
}
|
||||
else
|
||||
{
|
||||
FillBackground(control, combinedDs, _albumArtAccentColorTransition.Value, 0f,
|
||||
FillBackground(control, combinedDs, _albumArtAccentColor1Transition.Value, 0f,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.PureColorOverlayOpacity / 100.0);
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
using var geometry = CanvasGeometry.CreatePath(pathBuilder);
|
||||
var gradientStops = new CanvasGradientStop[]
|
||||
{
|
||||
new() { Position = 0.0f, Color = _albumArtAccentColorTransition.Value },
|
||||
new() { Position = 0.0f, Color = _albumArtAccentColor1Transition.Value },
|
||||
new() { Position = 1.0f, Color = Colors.Transparent }
|
||||
};
|
||||
|
||||
@@ -360,7 +360,7 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
var shadowEffectMask = CanvasHelper.GetAlphaMask(control, charMask, lineStartToCharMask, lineMask,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.LyricsShadowScope);
|
||||
using var foregroundShadowEffect = CanvasHelper.CreateForegroundShadowEffect(foregroundFontEffect, shadowEffectMask,
|
||||
_albumArtAccentColorTransition.Value, _liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.LyricsShadowAmount);
|
||||
_albumArtAccentColor1Transition.Value, _liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.LyricsShadowAmount);
|
||||
effectLayerDs.DrawImage(foregroundShadowEffect);
|
||||
}
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.IsLyricsGlowEffectEnabled)
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
/// <para><seealso cref="_isCoverAcrylicEffectAmountChanged"/> == true</para>
|
||||
/// <para><seealso cref="_isAlbumArtBgOpacityChanged"/> == true</para>
|
||||
/// <para><seealso cref="_albumArtBgTransition"/> 正在变化</para>
|
||||
/// <para><seealso cref="_albumArtAccentColorTransition"/> 正在变化</para>
|
||||
/// <para><seealso cref="_albumArtAccentColor1Transition"/> 正在变化</para>
|
||||
/// 如果上述条件均不满足,需调用 <seealso cref="UpdateAlbumArtBgRenderTarget"/> 来更新渲染缓存
|
||||
/// </summary>
|
||||
/// <param name="control"></param>
|
||||
@@ -190,7 +190,7 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
/// <para><seealso cref="_albumArtChanged"/> == true</para>
|
||||
/// <para><seealso cref="_isAlbumArtShadowAmountChanged"/> == true</para>
|
||||
/// <para><seealso cref="_albumArtBgTransition"/> 正在变化</para>
|
||||
/// <para><seealso cref="_albumArtAccentColorTransition"/> 正在变化</para>
|
||||
/// <para><seealso cref="_albumArtAccentColor1Transition"/> 正在变化</para>
|
||||
/// 如果上述条件均不满足,需调用 <seealso cref="UpdateAlbumArtRenderTarget"/> 来更新渲染缓存
|
||||
/// </summary>
|
||||
/// <param name="control"></param>
|
||||
@@ -223,7 +223,7 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
combinedDs.DrawImage(new ShadowEffect
|
||||
{
|
||||
Source = overlappedCovers,
|
||||
ShadowColor = _albumArtAccentColorTransition.Value,
|
||||
ShadowColor = _albumArtAccentColor1Transition.Value,
|
||||
BlurAmount = _liveStatesService.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings.CoverImageShadowAmount,
|
||||
Optimization = EffectOptimization.Speed,
|
||||
});
|
||||
|
||||
@@ -24,7 +24,25 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
|
||||
private readonly ValueTransition<Color> _albumArtAccentColorTransition = new(
|
||||
private readonly ValueTransition<Color> _albumArtAccentColor1Transition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
|
||||
private readonly ValueTransition<Color> _albumArtAccentColor2Transition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
|
||||
private readonly ValueTransition<Color> _albumArtAccentColor3Transition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
|
||||
private readonly ValueTransition<Color> _albumArtAccentColor4Transition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
|
||||
@@ -71,7 +71,31 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
}
|
||||
}
|
||||
|
||||
_effect?.Properties["iTime"] = Convert.ToSingle(TotalTime.TotalSeconds);
|
||||
//_effect?.Properties["iTime"] = Convert.ToSingle(TotalTime.TotalSeconds);
|
||||
|
||||
if (_effect != null)
|
||||
{
|
||||
var effectTime = Convert.ToSingle(_effect.Properties["iTime"]);
|
||||
effectTime += Convert.ToSingle(_elapsedTime.TotalSeconds);
|
||||
_effect.Properties["iTime"] = effectTime;
|
||||
|
||||
if (_albumArtAccentColor1Transition.IsTransitioning)
|
||||
{
|
||||
_effect.Properties["color1"] = _albumArtAccentColor1Transition.Value.ToVector3RGB();
|
||||
}
|
||||
if (_albumArtAccentColor2Transition.IsTransitioning)
|
||||
{
|
||||
_effect.Properties["color2"] = _albumArtAccentColor2Transition.Value.ToVector3RGB();
|
||||
}
|
||||
if (_albumArtAccentColor3Transition.IsTransitioning)
|
||||
{
|
||||
_effect.Properties["color3"] = _albumArtAccentColor3Transition.Value.ToVector3RGB();
|
||||
}
|
||||
if (_albumArtAccentColor4Transition.IsTransitioning)
|
||||
{
|
||||
_effect.Properties["color4"] = _albumArtAccentColor4Transition.Value.ToVector3RGB();
|
||||
}
|
||||
}
|
||||
|
||||
// 检测播放行变更
|
||||
var playingLineIndex = GetCurrentPlayingLineIndex();
|
||||
@@ -138,8 +162,8 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
{
|
||||
_isCoverAcrylicEffectAmountChanged = true;
|
||||
|
||||
_effect?.Properties["Width"] = Convert.ToSingle(_canvasWidth);
|
||||
_effect?.Properties["Height"] = Convert.ToSingle(_canvasHeight);
|
||||
_effect?.Properties["Width"] = (float)control.ConvertDipsToPixels((float)_canvasWidth, CanvasDpiRounding.Round);
|
||||
_effect?.Properties["Height"] = (float)control.ConvertDipsToPixels((float)_canvasHeight, CanvasDpiRounding.Round);
|
||||
}
|
||||
|
||||
if (_isSongInfoFontSizeChanged || _isSongTitleVisibilityChanged || _isSongArtistsVisibilityChanged)
|
||||
@@ -390,7 +414,12 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
_albumArtOpacityTransition.Update(_elapsedTime);
|
||||
_immersiveBgOpacityTransition.Update(_elapsedTime);
|
||||
_immersiveBgColorTransition.Update(_elapsedTime);
|
||||
_albumArtAccentColorTransition.Update(_elapsedTime);
|
||||
|
||||
_albumArtAccentColor1Transition.Update(_elapsedTime);
|
||||
_albumArtAccentColor2Transition.Update(_elapsedTime);
|
||||
_albumArtAccentColor3Transition.Update(_elapsedTime);
|
||||
_albumArtAccentColor4Transition.Update(_elapsedTime);
|
||||
|
||||
_albumArtBgTransition.Update(_elapsedTime);
|
||||
_lyricsBgBrightnessTransition.Update(_elapsedTime);
|
||||
_songInfoOpacityTransition.Update(_elapsedTime);
|
||||
@@ -558,24 +587,20 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
_adaptiveGrayedFontColor = _darkColor;
|
||||
brightness = 0.7f;
|
||||
_grayedEnvironmentalColor = _lightColor;
|
||||
_albumArtAccentColorTransition.StartTransition(_albumArtLightAccentColors.FirstOrDefault());
|
||||
|
||||
_effect?.Properties["color1"] = _albumArtLightAccentColors.ElementAtOrDefault(0).ToVector3RGB();
|
||||
_effect?.Properties["color2"] = _albumArtLightAccentColors.ElementAtOrDefault(1).ToVector3RGB();
|
||||
_effect?.Properties["color3"] = _albumArtLightAccentColors.ElementAtOrDefault(2).ToVector3RGB();
|
||||
_effect?.Properties["color4"] = _albumArtLightAccentColors.ElementAtOrDefault(3).ToVector3RGB();
|
||||
_albumArtAccentColor1Transition.StartTransition(_albumArtLightAccentColors.ElementAtOrDefault(0));
|
||||
_albumArtAccentColor2Transition.StartTransition(_albumArtLightAccentColors.ElementAtOrDefault(1));
|
||||
_albumArtAccentColor3Transition.StartTransition(_albumArtLightAccentColors.ElementAtOrDefault(2));
|
||||
_albumArtAccentColor4Transition.StartTransition(_albumArtLightAccentColors.ElementAtOrDefault(3));
|
||||
}
|
||||
else
|
||||
{
|
||||
_adaptiveGrayedFontColor = _lightColor;
|
||||
brightness = 0.3f;
|
||||
_grayedEnvironmentalColor = _darkColor;
|
||||
_albumArtAccentColorTransition.StartTransition(_albumArtDarkAccentColors.FirstOrDefault());
|
||||
|
||||
_effect?.Properties["color1"] = _albumArtDarkAccentColors.ElementAtOrDefault(0).ToVector3RGB();
|
||||
_effect?.Properties["color2"] = _albumArtDarkAccentColors.ElementAtOrDefault(1).ToVector3RGB();
|
||||
_effect?.Properties["color3"] = _albumArtDarkAccentColors.ElementAtOrDefault(2).ToVector3RGB();
|
||||
_effect?.Properties["color4"] = _albumArtDarkAccentColors.ElementAtOrDefault(3).ToVector3RGB();
|
||||
_albumArtAccentColor1Transition.StartTransition(_albumArtDarkAccentColors.ElementAtOrDefault(0));
|
||||
_albumArtAccentColor2Transition.StartTransition(_albumArtDarkAccentColors.ElementAtOrDefault(1));
|
||||
_albumArtAccentColor3Transition.StartTransition(_albumArtDarkAccentColors.ElementAtOrDefault(2));
|
||||
_albumArtAccentColor4Transition.StartTransition(_albumArtDarkAccentColors.ElementAtOrDefault(3));
|
||||
}
|
||||
|
||||
_lyricsBgBrightnessTransition.StartTransition(brightness);
|
||||
|
||||
@@ -182,7 +182,7 @@ Watch our introduction video (uploaded on 18 Aug 2025) on Bilibili [here](https:
|
||||
|
||||
If you are using a third-party modified Windows, you probably can not launch the app.
|
||||
|
||||
To solve this issue, please try to download from [Google Drive (v1.0.79.0)](https://drive.google.com/file/d/1YT8Cg5unPoNJO0FBR9s4w7T2pCLIZQz9/view?usp=sharing) (may not be the latest version) and follow the instructions [here](https://github.com/jayfunc/BetterLyrics/blob/dev/How2Install/How2Install.md).
|
||||
To solve this issue, please try to download from [Google Drive (v1.0.81.0)](https://drive.google.com/file/d/1YT8Cg5unPoNJO0FBR9s4w7T2pCLIZQz9/view?usp=sharing) (may not be the latest version) and follow the instructions [here](https://github.com/jayfunc/BetterLyrics/blob/dev/How2Install/How2Install.md).
|
||||
|
||||
## Build
|
||||
|
||||
|
||||
Reference in New Issue
Block a user