Skip to content

Commit c4a6d8d

Browse files
committed
添加高斯模糊半径配置选项
优化截图画笔设置
1 parent 12230c5 commit c4a6d8d

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

Core/Services/Config/KitopiaConfig.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ public bool EnsureDeviceIdentity()
168168
[ConfigFieldCategory("截图")]
169169
[ConfigField("截图直接复制到剪贴板", "截图直接复制到剪贴板,不显示工具栏", 0xE61C, ConfigFieldType.布尔)]
170170
public bool 截图直接复制到剪贴板 = false;
171-
171+
[ConfigField("截图马赛克模糊度", "数值越大生成的模糊效果越明显", 0xE61C, ConfigFieldType.整数, null, 15, 1, 1)]
172+
public int GaussianBlurRadius = 6;
172173
[ConfigField("截图方法", "使用特定的截图方法,某些情况下截图失败请尝试切换", 0xE61C, ConfigFieldType.自定义选项, actionName: "截图方法列表")]
173174
public string 截图方法 = "WGC";
174175

KitopiaAvalonia/Windows/ScreenCaptureWindow.axaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
xmlns:capture="clr-namespace:KitopiaAvalonia.Controls.Capture"
88
xmlns:plugin1="clr-namespace:Core.Services.Plugin;assembly=Core"
99
xmlns:utils="clr-namespace:Core.Utils;assembly=Core"
10+
xmlns:u="https://irihi.tech/ursa"
1011
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
1112
x:Class="KitopiaAvalonia.Windows.ScreenCaptureWindow"
1213
Title="ScreenCaptureWindow">
@@ -122,12 +123,12 @@
122123

123124
<!-- Row 2: Settings -->
124125
<Border Background="{DynamicResource SemiColorFill0}" CornerRadius="6" Padding="12,6,12,6">
125-
<Grid ColumnDefinitions="Auto, *, Auto, Auto">
126+
<Grid ColumnDefinitions="Auto, Auto,Auto, Auto, Auto">
126127
<TextBlock Text="粗细" VerticalAlignment="Center" Margin="0,0,12,0" Foreground="{DynamicResource SemiColorText1}" FontSize="12" />
127128
<Slider Grid.Column="1" ToolTip.Tip="画笔大小" Name="StrokeWidth" Minimum="1" Maximum="30" Value="3" Margin="0,0,16,0" VerticalAlignment="Center" Width="120" />
128-
129-
<TextBlock Grid.Column="2" Text="颜色" VerticalAlignment="Center" Margin="0,0,12,0" Foreground="{DynamicResource SemiColorText1}" FontSize="12" />
130-
<ColorPicker Grid.Column="3" SelectedIndex="1" ToolTip.Tip="画笔颜色" Name="ColorPicker" Foreground="{DynamicResource SemiColorText0}" Height="28" Width="48" />
129+
<u:NumericIntUpDown Grid.Column="2" Name="StrokeWidth2" Minimum="1" Maximum="30" Value="3" Margin="0,0,16,0" VerticalAlignment="Center" Width="60"/>
130+
<TextBlock Grid.Column="3" Text="颜色" VerticalAlignment="Center" Margin="0,0,12,0" Foreground="{DynamicResource SemiColorText1}" FontSize="12" />
131+
<ColorPicker Grid.Column="4" SelectedIndex="1" ToolTip.Tip="画笔颜色" Name="ColorPicker" Foreground="{DynamicResource SemiColorText0}" Height="28" Width="48" />
131132
</Grid>
132133
</Border>
133134
</StackPanel>

KitopiaAvalonia/Windows/ScreenCaptureWindow.axaml.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
using PluginCore.ExMethod;
2929
using Serilog;
3030
using SharpHook;
31+
using Ursa.Controls;
3132
using Math = System.Math;
3233
using MouseButton = Avalonia.Input.MouseButton;
3334
using Point = Avalonia.Point;
@@ -402,15 +403,20 @@ protected override void OnOpened(EventArgs e)
402403
base.OnOpened(e);
403404
SelectBox.LocationOrSizeChanged += LocationOrSizeChanged;
404405
StrokeWidth.ValueChanged += StrokeWidthOnValueChanged;
406+
StrokeWidth2.ValueChanged += StrokeWidth2OnValueChanged;
405407

406408
}
407409

410+
private void StrokeWidth2OnValueChanged(object? sender, ValueChangedEventArgs<int> e) {
411+
StrokeWidth.Value = (double)e.NewValue! ;
412+
}
413+
408414

409415
protected override void OnClosed(EventArgs e)
410416
{
411417
SelectBox.LocationOrSizeChanged -= LocationOrSizeChanged;
412418
StrokeWidth.ValueChanged -= StrokeWidthOnValueChanged;
413-
419+
StrokeWidth2.ValueChanged -= StrokeWidth2OnValueChanged;
414420
_renderTargetBitmap?.Dispose();
415421
MosaicImage.OpacityMask = null;
416422

@@ -936,7 +942,7 @@ private void SelectBox_OnPointerPressed(object? sender, PointerPressedEventArgs
936942
}
937943

938944
var process = GaussianBlur1.GaussianBlur(bytes, source.Width,
939-
source.Height, 4);
945+
source.Height, ConfigManger.Config.GaussianBlurRadius);
940946
var writeableBitmap2 = new WriteableBitmap(
941947
new PixelSize(source.Width, source.Height),
942948
new Vector(96, 96), PixelFormat.Bgra8888);

0 commit comments

Comments
 (0)