mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-19 02:23:01 +08:00
feat: Background stretch modes (#12365)
* feat: Background stretch modes * i18n: all language translations with ja-jp and ko-kr AI translated * i18n: make thy name thy name * chore: 优化显示效果 --------- Co-authored-by: uye <99072975+ABA2396@users.noreply.github.com>
This commit is contained in:
@@ -56,6 +56,7 @@ namespace MaaWpfGui.Constants
|
||||
public const string CustomCulture = "GUI.CustomCulture";
|
||||
|
||||
public const string BackgroundImagePath = "GUI.Background.ImagePath";
|
||||
public const string BackgroundImageStretchMode = "GUI.Background.StretchMode";
|
||||
public const string BackgroundOpacity = "GUI.Background.Opacity";
|
||||
public const string BackgroundBlurEffectRadius = "GUI.Background.BlurEffectRadius";
|
||||
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
<system:String x:Key="BackgroundImage">Background Image</system:String>
|
||||
<system:String x:Key="BackgroundOpacity">Background Opacity</system:String>
|
||||
<system:String x:Key="BackgroundBlurRadius">Background Blur Radius</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchMode">Background Stretch Mode</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeNone">None</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeFill">Fill</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeUniform">Uniform (Fit)</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeUniformToFill">Uniform to Fill (Cover)</system:String>
|
||||
<system:String x:Key="UiTheme">UI Theme</system:String>
|
||||
<system:String x:Key="HotKeySettings">HotKeys</system:String>
|
||||
<system:String x:Key="UpdateSettings">Update</system:String>
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
<system:String x:Key="BackgroundImage">背景画像</system:String>
|
||||
<system:String x:Key="BackgroundOpacity">背景の不透明度</system:String>
|
||||
<system:String x:Key="BackgroundBlurRadius">背景のぼかし半径</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchMode">背景画像の伸縮モード</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeNone">伸縮なし</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeFill">引き伸ばし(フィル)</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeUniform">アスペクト比保持(フィット)</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeUniformToFill">アスペクト比保持(トリミング)</system:String>
|
||||
<system:String x:Key="UiTheme">UI主題</system:String>
|
||||
<system:String x:Key="HotKeySettings">ホットキー設定</system:String>
|
||||
<system:String x:Key="UpdateSettings">アップデート設定</system:String>
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
<system:String x:Key="BackgroundImage">배경 이미지</system:String>
|
||||
<system:String x:Key="BackgroundOpacity">배경 불투명도</system:String>
|
||||
<system:String x:Key="BackgroundBlurRadius">배경 흐림 반경</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchMode">배경 이미지 채우기 모드</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeNone">늘리지 않음</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeFill">늘려 채움</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeUniform">비율 유지 (맞춤)</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeUniformToFill">비율 유지 (자르기)</system:String>
|
||||
<system:String x:Key="HotKeySettings">단축키 설정</system:String>
|
||||
<system:String x:Key="UpdateSettings">업데이트</system:String>
|
||||
<system:String x:Key="AboutUs">정보</system:String>
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
<system:String x:Key="BackgroundImage">背景图片</system:String>
|
||||
<system:String x:Key="BackgroundOpacity">背景不透明度</system:String>
|
||||
<system:String x:Key="BackgroundBlurRadius">背景模糊半径</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchMode">背景填充模式</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeNone">无拉伸</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeFill">拉伸填充</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeUniform">等比适应</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeUniformToFill">等比填充(裁剪)</system:String>
|
||||
<system:String x:Key="UiTheme">界面主题</system:String>
|
||||
<system:String x:Key="HotKeySettings">热键设置</system:String>
|
||||
<system:String x:Key="UpdateSettings">更新设置</system:String>
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
<system:String x:Key="BackgroundImage">背景圖片</system:String>
|
||||
<system:String x:Key="BackgroundOpacity">背景不透明度</system:String>
|
||||
<system:String x:Key="BackgroundBlurRadius">背景模糊半徑</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchMode">背景填充模式</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeNone">無拉伸</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeFill">拉伸填充</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeUniform">等比適應</system:String>
|
||||
<system:String x:Key="BackgroundImageStretchModeUniformToFill">等比填充(裁剪)</system:String>
|
||||
<system:String x:Key="UiTheme">介面主題</system:String>
|
||||
<system:String x:Key="HotKeySettings">熱鍵設定</system:String>
|
||||
<system:String x:Key="UpdateSettings">更新設定</system:String>
|
||||
|
||||
@@ -13,12 +13,16 @@
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.Utilities.ValueType;
|
||||
using Microsoft.Win32;
|
||||
using Stylet;
|
||||
|
||||
@@ -70,6 +74,26 @@ public class BackgroundSettingsUserControlModel : PropertyChangedBase
|
||||
}
|
||||
}
|
||||
|
||||
private static Stretch _backgroundImageStretchMode = (Stretch)Enum.Parse(typeof(Stretch), ConfigurationHelper.GetGlobalValue(ConfigurationKeys.BackgroundImageStretchMode, Stretch.Fill.ToString()));
|
||||
|
||||
public Stretch BackgroundImageStretchMode
|
||||
{
|
||||
get => _backgroundImageStretchMode;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _backgroundImageStretchMode, value);
|
||||
ConfigurationHelper.SetGlobalValue(ConfigurationKeys.BackgroundImageStretchMode, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static List<CombinedData> BackgroundImageStretchModeList { get; } =
|
||||
[
|
||||
new() { Display = LocalizationHelper.GetString("BackgroundImageStretchModeNone"), Value = Stretch.None.ToString() },
|
||||
new() { Display = LocalizationHelper.GetString("BackgroundImageStretchModeFill"), Value = Stretch.Fill.ToString() },
|
||||
new() { Display = LocalizationHelper.GetString("BackgroundImageStretchModeUniform"), Value = Stretch.Uniform.ToString() },
|
||||
new() { Display = LocalizationHelper.GetString("BackgroundImageStretchModeUniformToFill"), Value = Stretch.UniformToFill.ToString() },
|
||||
];
|
||||
|
||||
private static BitmapImage? RefreshBackgroundImage(string imagePath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(imagePath) || !File.Exists(imagePath))
|
||||
|
||||
@@ -66,12 +66,14 @@
|
||||
<Rectangle Fill="{DynamicResource RegionBrush}" />
|
||||
<Image
|
||||
Name="BgImage"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
DataContext="{Binding Source={x:Static ui:SettingsViewModel.BackgroundSettings}}"
|
||||
Opacity="{c:Binding 'BackgroundOpacity / 100.0'}"
|
||||
RenderOptions.BitmapScalingMode="LowQuality"
|
||||
RenderOptions.CachingHint="Cache"
|
||||
Source="{c:Binding BackgroundImage}"
|
||||
Stretch="Fill">
|
||||
Stretch="{c:Binding BackgroundImageStretchMode}">
|
||||
<Image.Effect>
|
||||
<BlurEffect Radius="{Binding BackgroundBlurEffectRadius}" />
|
||||
</Image.Effect>
|
||||
|
||||
@@ -64,5 +64,21 @@
|
||||
</hc:PreviewSlider.PreviewContent>
|
||||
</hc:PreviewSlider>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Margin="10"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<controls:TextBlock HorizontalAlignment="Center" Text="{DynamicResource BackgroundImageStretchMode}" />
|
||||
<hc:ComboBox
|
||||
Width="200"
|
||||
Margin="10"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
DisplayMemberPath="Display"
|
||||
IsEditable="True"
|
||||
IsEnabled="True"
|
||||
ItemsSource="{c:Binding BackgroundImageStretchModeList}"
|
||||
SelectedValue="{c:Binding BackgroundImageStretchMode}"
|
||||
SelectedValuePath="Value" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
Reference in New Issue
Block a user