[feature] 荧光笔,板擦形状橡皮切换,清空墨迹删除历史记录。

This commit is contained in:
Dubi906w 2024-05-12 14:23:50 +08:00
parent fda23c5c96
commit 80c32cbbfb
14 changed files with 1270 additions and 474 deletions

View File

@ -1,9 +1,36 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace Ink_Canvas.Converter
{
public class BooleanToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((bool)value == true)
{
return Visibility.Visible;
}
else
{
return Visibility.Collapsed;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((bool)value == true)
{
return Visibility.Visible;
}
else
{
return Visibility.Collapsed;
}
}
}
public class VisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

View File

@ -185,6 +185,7 @@
<Resource Include="Resources\Icons-png\playCircle.png" />
<Resource Include="Resources\Icons-png\redo.png" />
<Resource Include="Resources\Icons-png\setting.png" />
<Resource Include="Resources\Icons-png\transparent-grid.png" />
<Resource Include="Resources\Icons-png\undo.png" />
<Resource Include="Resources\Icons-png\minimize.png" />
<Resource Include="Resources\Icons-png\penUpright.png" />
@ -304,7 +305,9 @@
<CopyToOutputDirectory></CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\new-icons\hand-move.png" />
<Resource Include="Resources\new-icons\highlighter-white.png" />
<Resource Include="Resources\new-icons\multi-touch.png" />
<Resource Include="Resources\new-icons\osu-lazer-triangles.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\new-icons\pen-lined.png" />
@ -325,6 +328,7 @@
<ItemGroup>
<Resource Include="Resources\new-icons\lasso-select-lined.png" />
<Resource Include="Resources\new-icons\lasso-select-solid.png" />
<Resource Include="Resources\new-icons\pen-white.png" />
<Resource Include="Resources\new-icons\rotate.png" />
</ItemGroup>
<ItemGroup>
@ -443,9 +447,13 @@
<Compile Remove="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Remove="Resources\Icons-png\transparent-grid.png" />
<None Remove="Resources\new-icons\end-slides-show.png" />
<None Remove="Resources\new-icons\hand-move.png" />
<None Remove="Resources\new-icons\highlighter-white.png" />
<None Remove="Resources\new-icons\multi-touch.png" />
<None Remove="Resources\new-icons\osu-lazer-triangles.png" />
<None Remove="Resources\new-icons\pen-white.png" />
<None Remove="Resources\new-icons\rotate.png" />
<None Remove="Resources\new-icons\zoom.png" />
</ItemGroup>

View File

@ -30,6 +30,7 @@
<Window.Resources>
<c:VisibilityConverter x:Key="VisibilityConverter"/>
<c:IsEnabledToOpacityConverter x:Key="IsEnabledToOpacityConverter"/>
<c:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<RoutedUICommand x:Key="KeyExit" Text=" "/>
<RoutedUICommand x:Key="HotKey_Command_Undo" Text=" "/>
<RoutedUICommand x:Key="HotKey_Command_Redo" Text=" "/>
@ -812,9 +813,9 @@
<GroupBox.Header>
<TextBlock Text="启动" FontWeight="Bold" Foreground="#18181b" FontSize="26"/>
</GroupBox.Header>
<ui:SimpleStackPanel Spacing="12">
<ui:ToggleSwitch Name="ToggleSwitchIsAutoUpdate" Header="自动检查更新" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchIsAutoUpdate_Toggled"/>
<ui:ToggleSwitch Name="ToggleSwitchIsAutoUpdateWithSilence" Header="静默更新" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchIsAutoUpdateWithSilence_Toggled"/>
<ui:SimpleStackPanel Spacing="6">
<ui:ToggleSwitch Visibility="Collapsed" Name="ToggleSwitchIsAutoUpdate" Header="自动检查更新" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchIsAutoUpdate_Toggled"/>
<ui:ToggleSwitch Visibility="Collapsed" Name="ToggleSwitchIsAutoUpdateWithSilence" Header="静默更新" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchIsAutoUpdateWithSilence_Toggled"/>
<Border BorderBrush="Black" BorderThickness="1" CornerRadius="5" Padding="12" Visibility="{Binding ElementName=ToggleSwitchIsAutoUpdateWithSilence, Path=Visibility}">
<ui:SimpleStackPanel Spacing="12">
<TextBlock Text="# 关闭静默更新后,已完成安装包的下载后将会弹窗询问是否进行更新,开启静默更新后将会在安装包下载完成后每隔十分钟进行如下检测:①处于静默更新时间段内 ②未处于书写模式 ③未处于画板内。若以上检测通过即会关闭软件进行自动更新。" TextWrapping="Wrap" Foreground="#666666"/>
@ -836,10 +837,14 @@
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
</Border>
<ui:ToggleSwitch Name="ToggleSwitchRunAtStartup" Header="开机时运行" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchRunAtStartup_Toggled"/>
<ui:ToggleSwitch Name="ToggleSwitchFoldAtStartup" Header="开机运行后收纳到侧边栏" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchFoldAtStartup_Toggled"/>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="开机时运行" VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0"/>
<ui:ToggleSwitch Name="ToggleSwitchRunAtStartup" IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold" OnContent="开" OffContent="关" Toggled="ToggleSwitchRunAtStartup_Toggled" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="开机运行后收纳到侧边栏" VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0"/>
<ui:ToggleSwitch Name="ToggleSwitchFoldAtStartup" IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold" OnContent="开" OffContent="关" Toggled="ToggleSwitchFoldAtStartup_Toggled" />
</ui:SimpleStackPanel>
<!--
<ui:ToggleSwitch Name="ToggleSwitchAutoHideCanvas" Header="自动隐藏画板" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchAutoHideCanvas_Toggled"/>
<ui:ToggleSwitch Name="ToggleSwitchAutoEnterModeFinger" Header="自动进入手指模式" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchAutoEnterModeFinger_Toggled"/>
@ -850,47 +855,47 @@
<GroupBox.Header>
<TextBlock Text="画板和墨迹" FontWeight="Bold" Foreground="#18181b" FontSize="26"/>
</GroupBox.Header>
<ui:SimpleStackPanel Spacing="12">
<ui:ToggleSwitch Name="ToggleSwitchShowCursor" Header="显示画笔光标" IsOn="False" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchShowCursor_Toggled"/>
<!--
<TextBlock Text="画笔样式" FontFamily="Microsoft YaHei UI" FontSize="14"/>
<ComboBox Name="ComboBoxPenStyle" FontFamily="Microsoft YaHei UI" SelectedIndex="0" SelectionChanged="ComboBoxPenStyle_SelectionChanged">
<ComboBoxItem Content="模拟笔锋(根据墨迹尾部计算)" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="模拟笔锋(根据速度计算)" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="无笔锋" FontFamily="Microsoft YaHei UI"/>
</ComboBox>
<ui:ToggleSwitch x:Name="ToggleSwitchModeFinger" Header="手指模式" IsOn="False" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关"/>
<TextBlock Text="# 此选项仅适用于可获取触摸面积的屏幕" TextWrapping="Wrap" Foreground="#666666"/>
<TextBlock Text="橡皮模式" FontFamily="Microsoft YaHei UI" FontSize="14"/>
<ComboBox Name="ComboBoxEraserType" FontFamily="Microsoft YaHei UI" SelectedIndex="0" SelectionChanged="ComboBoxEraserType_OnSelectionChanged">
<ComboBoxItem Content="交替切换" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="面积擦" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="笔画擦" FontFamily="Microsoft YaHei UI"/>
</ComboBox>
-->
<TextBlock Text="橡皮大小" FontFamily="Microsoft YaHei UI" FontSize="14"/>
<ComboBox Name="ComboBoxEraserSize" FontFamily="Microsoft YaHei UI" SelectedIndex="2" SelectionChanged="ComboBoxEraserSize_SelectionChanged">
<ComboBoxItem Content="小" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="较小" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="中(默认)" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="较大" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="大" FontFamily="Microsoft YaHei UI"/>
</ComboBox>
<ui:ToggleSwitch Name="ToggleSwitchHideStrokeWhenSelecting" Header="退出画板模式后隐藏墨迹" IsOn="False" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchHideStrokeWhenSelecting_Toggled"/>
<ui:SimpleStackPanel Spacing="6">
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="显示画笔光标" VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0"/>
<ui:ToggleSwitch Name="ToggleSwitchShowCursor" IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold" OnContent="开" OffContent="关" Toggled="ToggleSwitchShowCursor_Toggled" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="橡皮大小" VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0"/>
<ComboBox Name="ComboBoxEraserSize" FontFamily="Microsoft YaHei UI" SelectedIndex="2" SelectionChanged="ComboBoxEraserSize_SelectionChanged">
<ComboBoxItem Content="小" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="较小" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="中(默认)" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="较大" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="大" FontFamily="Microsoft YaHei UI"/>
</ComboBox>
</ui:SimpleStackPanel>
<TextBlock Text="# 非实时切换,下一次使用面积擦时生效。" TextWrapping="Wrap" Foreground="#666666"/>
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0" Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4"/>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="退出画板模式后隐藏墨迹" VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0"/>
<ui:ToggleSwitch Name="ToggleSwitchHideStrokeWhenSelecting" IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold" OnContent="开" OffContent="关" Toggled="ToggleSwitchHideStrokeWhenSelecting_Toggled" />
</ui:SimpleStackPanel>
<TextBlock Text="# 开启 退出画板模式后隐藏墨迹 选项后,进入 PPT 模式时未处于批注模式时不会显示墨迹。" TextWrapping="Wrap" Foreground="#666666"/>
<!--
<ui:ToggleSwitch Name="ToggleSwitchUsingWhiteboard" Header="使用白板 (白色背景)" IsOn="False" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchUsingWhiteboard_Toggled"/>
-->
<TextBlock Text="保留双曲线渐近线" FontFamily="Microsoft YaHei UI" FontSize="14"/>
<ComboBox Name="ComboBoxHyperbolaAsymptoteOption" FontFamily="Microsoft YaHei UI" SelectedIndex="0" SelectionChanged="ComboBoxHyperbolaAsymptoteOption_SelectionChanged">
<ComboBoxItem Content="是" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="否" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="每次询问" FontFamily="Microsoft YaHei UI"/>
</ComboBox>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="清空墨迹时删除墨迹历史记录" VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0"/>
<ui:ToggleSwitch Name="ToggleSwitchClearCanvasAndClearTimeMachine" IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold" OnContent="开" OffContent="关" Toggled="ToggleSwitchClearCanvasAndClearTimeMachine_Toggled" />
</ui:SimpleStackPanel>
<TextBlock Text="# 开启后点击清屏按钮将会一同清理TimeMachine中的墨迹历史记录这也会导致清屏后无法撤销恢复到原来的笔迹请慎重使用" TextWrapping="Wrap" Foreground="#666666"/>
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0" Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4"/>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="保留双曲线渐近线" VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0"/>
<ComboBox Name="ComboBoxHyperbolaAsymptoteOption" FontFamily="Microsoft YaHei UI" SelectedIndex="0" SelectionChanged="ComboBoxHyperbolaAsymptoteOption_SelectionChanged">
<ComboBoxItem Content="是" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="否" FontFamily="Microsoft YaHei UI"/>
<ComboBoxItem Content="每次询问" FontFamily="Microsoft YaHei UI"/>
</ComboBox>
</ui:SimpleStackPanel>
<TextBlock Text="# 请注意,若不保留双曲线渐近线可能会有遇到撤回相关的 BUG 影响用。" TextWrapping="Wrap" Foreground="#666666"/>
<ui:ToggleSwitch Name="ToggleSwitchFitToCurve" Header="让墨迹使用贝塞尔曲线平滑" IsOn="False" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchFitToCurve_Toggled"/>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="让墨迹使用贝塞尔曲线平滑处理" VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0"/>
<ui:ToggleSwitch Name="ToggleSwitchFitToCurve" IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold" OnContent="开" OffContent="关" Toggled="ToggleSwitchFitToCurve_Toggled" />
</ui:SimpleStackPanel>
<TextBlock Text="# 开启 让墨迹使用贝塞尔曲线平滑 选项后所有墨迹将会使用FitToCurve进行贝塞尔曲线平滑化如果不喜欢可以关闭。" TextWrapping="Wrap" Foreground="#666666"/>
</ui:SimpleStackPanel>
</GroupBox>
@ -898,11 +903,17 @@
<GroupBox.Header>
<TextBlock Text="手势" FontWeight="Bold" Foreground="#18181b" FontSize="26"/>
</GroupBox.Header>
<ui:SimpleStackPanel Spacing="12">
<ui:ToggleSwitch Name="ToggleSwitchAutoSwitchTwoFingerGesture" Header="自动开关两指缩放功能" IsOn="True" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchAutoSwitchTwoFingerGesture_Toggled"/>
<TextBlock Text="# 开启 自动开关两指缩放功能 后退出画板模式时自动关闭双指移动手势,进入画板模式时自动开启双指移动手势" TextWrapping="Wrap" Foreground="#666666"/>
<ui:ToggleSwitch Name="ToggleSwitchEnableTwoFingerRotationOnSelection" Header="允许双指旋转选中的墨迹" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchEnableTwoFingerRotation_Toggled"/>
<ui:SimpleStackPanel Spacing="6">
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="进退白板模式自动开关双指移动功能" VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0"/>
<ui:ToggleSwitch Name="ToggleSwitchAutoSwitchTwoFingerGesture" IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold" OnContent="开" OffContent="关" Toggled="ToggleSwitchAutoSwitchTwoFingerGesture_Toggled" />
</ui:SimpleStackPanel>
<TextBlock Text="# 开启后退出画板模式时自动关闭双指移动手势,进入白板模式时自动开启双指移动手势" TextWrapping="Wrap" Foreground="#666666"/>
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0" Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4"/>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="允许双指旋转与缩放选中的墨迹" VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0"/>
<ui:ToggleSwitch Name="ToggleSwitchEnableTwoFingerRotationOnSelection" IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold" OnContent="开" OffContent="关" Toggled="ToggleSwitchEnableTwoFingerRotation_Toggled" />
</ui:SimpleStackPanel>
<TextBlock Text="# 允许选中墨迹后对墨迹进行双指或多指缩放操作(此设置不受“允许双指旋转”设置的影响)" TextWrapping="Wrap" Foreground="#666666"/>
</ui:SimpleStackPanel>
</GroupBox>
@ -916,7 +927,8 @@
<ui:ToggleSwitch Name="ToggleSwitchEnableInkToShape" IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold" OnContent="开" OffContent="关" Toggled="ToggleSwitchEnableInkToShape_Toggled" />
</ui:SimpleStackPanel>
<TextBlock Text="# 可实现智能识别圆、三角形、矩形,并自动转换为规范图形。" Foreground="#666666"/>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<ui:SimpleStackPanel Spacing="6" Visibility="{Binding ElementName=ToggleSwitchEnableInkToShape, Path=IsOn, Converter={StaticResource BooleanToVisibilityConverter}}">
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="阻止矫正后的矩形带有模拟压感值" VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0"/>
<ui:ToggleSwitch Name="ToggleSwitchEnableInkToShapeNoFakePressureRectangle" IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold" OnContent="开" OffContent="关" Toggled="ToggleSwitchEnableInkToShapeNoFakePressureRectangle_Toggled" />
</ui:SimpleStackPanel>
@ -946,6 +958,8 @@
</CheckBox.Content>
</CheckBox>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
</GroupBox>
<GroupBox Name="GroupBoxAppearanceNewUI">
@ -1635,14 +1649,43 @@
<ui:SimpleStackPanel Name="StackPanelCanvasControls" Visibility="Visible" Orientation="{Binding ElementName=StackPanelFloatingBar, Path=Orientation}">
<ui:SimpleStackPanel Width="0" Orientation="{Binding ElementName=StackPanelFloatingBar, Path=Orientation}">
<Grid Margin="0,5,0,5" Width="0" RenderTransformOrigin="0.5,0.5">
<Border x:Name="PenPalette" Visibility="Visible" Background="white" Opacity="0.9" BorderBrush="{DynamicResource FloatBarBorderBrush}" BorderThickness="1" CornerRadius="8" Margin="-160,-192,-33,32">
<Border x:Name="PenPalette" Visibility="Visible" Background="white" Opacity="0.9" BorderBrush="{DynamicResource FloatBarBorderBrush}" BorderThickness="1" CornerRadius="8" Margin="-160,-200,-33,32">
<ui:SimpleStackPanel>
<Border BorderBrush="#1e3a8a" BorderThickness="0,0,0,1" CornerRadius="8,8,0,0" Background="#2563eb" Margin="-1,-1,-1,0" Padding="1,1,1,0">
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
<TextBlock Text="笔选项" Foreground="White" Padding="8,5,44,5" FontSize="11" FontWeight="Bold" TextAlignment="Center"/>
<Border BorderBrush="#1e3a8a" Height="32" BorderThickness="0,0,0,1" CornerRadius="8,8,0,0" Background="#2563eb" Margin="-1,-1,-1,0" Padding="1,1,1,0">
<ui:SimpleStackPanel Orientation="Vertical" VerticalAlignment="Center">
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" Margin="8,0,0,0" Spacing="4">
<Border x:Name="DefaultPenTabButton" MouseDown="SwitchToDefaultPen" Background="#48dbeafe" Height="20" Width="52" CornerRadius="3">
<Canvas>
<ui:SimpleStackPanel x:Name="DefaultPenTabButtonIndicator" Visibility="Visible" Orientation="Horizontal" Canvas.Left="14" Canvas.Right="14" Canvas.Bottom="0">
<Border Width="24" Height="2" Background="#fafafa" CornerRadius="1"></Border>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Vertical" Height="20" Width="52">
<ui:SimpleStackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,3">
<Image Source="/Resources/new-icons/pen-white.png" RenderOptions.BitmapScalingMode="HighQuality" Height="13" Width="13"/>
<TextBlock x:Name="DefaultPenTabButtonText" Foreground="White" FontWeight="Medium" FontSize="9" TextAlignment="Center" Text="签字笔" Margin="2,1,0,0"/>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
</Canvas>
</Border>
<Border x:Name="HighlightPenTabButton" MouseDown="SwitchToHighlighterPen" Background="Transparent" Height="20" Width="52" CornerRadius="3">
<Canvas>
<ui:SimpleStackPanel Visibility="Collapsed" x:Name="HighlightPenTabButtonIndicator" Orientation="Horizontal" Canvas.Left="14" Canvas.Right="14" Canvas.Bottom="0">
<Border Width="24" Height="2" Background="#fafafa" CornerRadius="1"></Border>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Vertical" Height="20" Width="52">
<ui:SimpleStackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,3">
<Image Source="/Resources/new-icons/highlighter-white.png" RenderOptions.BitmapScalingMode="HighQuality" Height="13" Width="13"/>
<TextBlock x:Name="HighlightPenTabButtonText" Foreground="White" FontWeight="Medium" FontSize="9" TextAlignment="Center" Text="荧光笔" Margin="2,1,0,0"/>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
</Canvas>
</Border>
<Image Margin="48,0,0,0" Source="/Resources/new-icons/close-white.png" RenderOptions.BitmapScalingMode="HighQuality" Height="16" Width="16" MouseDown="Border_MouseDown" MouseUp="CloseBordertools_MouseUp"/>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
</Border>
<Viewbox Margin="12,8,12,0" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill" >
<Viewbox Name="DefaultPenPropsPanel" Visibility="Collapsed" Margin="12,8,12,0" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill" >
<ui:SimpleStackPanel>
<Controls:UniformGrid Columns="2" Width="300" Height="55">
<ui:SimpleStackPanel Orientation="Horizontal" Height="35">
@ -1687,7 +1730,16 @@
</StackPanel>
</ui:SimpleStackPanel>
</Viewbox>
<Viewbox Margin="0,8,0,0" Stretch="Fill">
<Viewbox Name="HighlighterPenPropsPanel" Margin="12,8,12,0" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill" >
<ui:SimpleStackPanel>
<StackPanel Orientation="Horizontal" Height="30">
<Label Margin="0,0,10,0" Content="粗细" FontWeight="Bold" Foreground="{DynamicResource FloatBarForeground}" FontSize="17" VerticalAlignment="Center"/>
<Slider x:Name="HighlighterWidthSlider" Minimum="15" Maximum="45" Width="208" FontFamily="Microsoft YaHei UI" FontSize="20" IsSnapToTickEnabled="True" Value="20" TickFrequency="1" TickPlacement="None" ValueChanged="HighlighterWidthSlider_ValueChanged"/>
<TextBlock Text="{Binding Value, ElementName=HighlighterWidthSlider, Mode=OneWay}" FontFamily="Consolas" VerticalAlignment="Bottom" Margin="10,0,0,4.5" FontSize="15"/>
</StackPanel>
</ui:SimpleStackPanel>
</Viewbox>
<Viewbox x:Name="DefaultPenColorsPanel" Visibility="Collapsed" Margin="0,8,0,0" Stretch="Fill">
<ui:SimpleStackPanel Width="300" Margin="0,0,0,0">
<!--<TextBlock FontSize="25">画笔颜色</TextBlock>-->
<Border Width="300" Height="100" BorderBrush="Black" BorderThickness="0" CornerRadius="5">
@ -1756,6 +1808,153 @@
</Border>
</ui:SimpleStackPanel>
</Viewbox>
<Viewbox x:Name="HighlighterPenColorsPanel" Visibility="Visible" Margin="0,8,0,0" Stretch="Fill">
<ui:SimpleStackPanel Width="300" Margin="0,0,0,0">
<!--<TextBlock FontSize="25">画笔颜色</TextBlock>-->
<Border Width="300" Height="110" BorderBrush="Black" BorderThickness="0" CornerRadius="5">
<Controls:UniformGrid Rows="2" Height="110">
<ui:SimpleStackPanel Height="45" Orientation="Horizontal" Width="270">
<Controls:UniformGrid Columns="5" Width="270" Margin="0">
<Border x:Name="HighlighterPenColorBlack" BorderBrush="#e4e4e7" BorderThickness="1.5" CornerRadius="100" Width="45" MouseUp="BtnHighlighterColorBlack_Click">
<Canvas>
<Image Source="/Resources/Icons-png/transparent-grid.png" Width="42" Height="42">
<Image.Clip>
<EllipseGeometry Center="21,21" RadiusX="21" RadiusY="21" />
</Image.Clip>
</Image>
<Border Background="Black" Width="42" Height="42" CornerRadius="21" Opacity="0.75"></Border>
<Viewbox Name="HighlighterPenViewboxBtnColorBlackContent" Visibility="Visible" Canvas.Top="9" Canvas.Left="9">
<Image Source="/Resources/new-icons/checked-white.png" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="24" Height="24" Margin="0,0,0,0"/>
</Viewbox>
</Canvas>
</Border>
<Border x:Name="HighlighterPenColorWhite" Background="White" BorderBrush="#dddddd" BorderThickness="1.5" CornerRadius="100" Width="45" MouseUp="BtnHighlighterColorWhite_Click">
<Canvas>
<Image Source="/Resources/Icons-png/transparent-grid.png" Width="42" Height="42">
<Image.Clip>
<EllipseGeometry Center="21,21" RadiusX="21" RadiusY="21" />
</Image.Clip>
</Image>
<Border Background="White" Width="42" Height="42" CornerRadius="21" Opacity="0.75"></Border>
<Viewbox Name="HighlighterPenViewboxBtnColorWhiteContent" Visibility="Visible" Canvas.Top="9" Canvas.Left="9">
<Image Source="/Resources/new-icons/checked-black.png" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="24" Height="24" Margin="0,0,0,0"/>
</Viewbox>
</Canvas>
</Border>
<Border x:Name="HighlighterPenColorRed" BorderBrush="#fecaca" BorderThickness="1.5" CornerRadius="100" Width="45" MouseUp="BtnHighlighterColorRed_Click">
<Canvas>
<Image Source="/Resources/Icons-png/transparent-grid.png" Width="42" Height="42">
<Image.Clip>
<EllipseGeometry Center="21,21" RadiusX="21" RadiusY="21" />
</Image.Clip>
</Image>
<Border Background="#ef4444" Width="42" Height="42" CornerRadius="21" Opacity="0.75"></Border>
<Viewbox Name="HighlighterPenViewboxBtnColorRedContent" Visibility="Visible" Canvas.Top="9" Canvas.Left="9">
<Image Source="/Resources/new-icons/checked-white.png" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="24" Height="24" Margin="0,0,0,0"/>
</Viewbox>
</Canvas>
</Border>
<Border x:Name="HighlighterPenColorYellow" BorderBrush="#fef08a" BorderThickness="1.5" CornerRadius="100" Width="45" MouseUp="BtnHighlighterColorYellow_Click">
<Canvas>
<Image Source="/Resources/Icons-png/transparent-grid.png" Width="42" Height="42">
<Image.Clip>
<EllipseGeometry Center="21,21" RadiusX="21" RadiusY="21" />
</Image.Clip>
</Image>
<Border Background="#eab308" Width="42" Height="42" CornerRadius="21" Opacity="0.75"></Border>
<Viewbox Name="HighlighterPenViewboxBtnColorYellowContent" Visibility="Visible" Canvas.Top="9" Canvas.Left="9">
<Image Source="/Resources/new-icons/checked-black.png" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="24" Height="24" Margin="0,0,0,0"/>
</Viewbox>
</Canvas>
</Border>
<Border x:Name="HighlighterPenColorGreen" BorderBrush="#bbf7d0" BorderThickness="1.5" CornerRadius="100" Width="45" MouseUp="BtnHighlighterColorGreen_Click">
<Canvas>
<Image Source="/Resources/Icons-png/transparent-grid.png" Width="42" Height="42">
<Image.Clip>
<EllipseGeometry Center="21,21" RadiusX="21" RadiusY="21" />
</Image.Clip>
</Image>
<Border Background="#22c55e" Width="42" Height="42" CornerRadius="21" Opacity="0.75"></Border>
<Viewbox Name="HighlighterPenViewboxBtnColorGreenContent" Visibility="Visible" Canvas.Top="9" Canvas.Left="9">
<Image Source="/Resources/new-icons/checked-black.png" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="24" Height="24" Margin="0,0,0,0"/>
</Viewbox>
</Canvas>
</Border>
</Controls:UniformGrid>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Height="45" Orientation="Horizontal" Width="270">
<Controls:UniformGrid Columns="5" Width="270" Margin="0">
<Border x:Name="HighlighterPenColorZinc" BorderBrush="#e4e4e7" BorderThickness="1.5" CornerRadius="100" Width="45" MouseUp="BtnHighlighterColorZinc_Click">
<Canvas>
<Image Source="/Resources/Icons-png/transparent-grid.png" Width="42" Height="42">
<Image.Clip>
<EllipseGeometry Center="21,21" RadiusX="21" RadiusY="21" />
</Image.Clip>
</Image>
<Border Background="#71717a" Width="42" Height="42" CornerRadius="21" Opacity="0.75"></Border>
<Viewbox Name="HighlighterPenViewboxBtnColorZincContent" Visibility="Visible" Canvas.Top="9" Canvas.Left="9">
<Image Source="/Resources/new-icons/checked-white.png" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="24" Height="24" Margin="0,0,0,0"/>
</Viewbox>
</Canvas>
</Border>
<Border x:Name="HighlighterPenColorBlue" BorderBrush="#bfdbfe" BorderThickness="1.5" CornerRadius="100" Width="45" MouseUp="BtnHighlighterColorBlue_Click">
<Canvas>
<Image Source="/Resources/Icons-png/transparent-grid.png" Width="42" Height="42">
<Image.Clip>
<EllipseGeometry Center="21,21" RadiusX="21" RadiusY="21" />
</Image.Clip>
</Image>
<Border Background="#3b82f6" Width="42" Height="42" CornerRadius="21" Opacity="0.75"></Border>
<Viewbox Name="HighlighterPenViewboxBtnColorBlueContent" Visibility="Visible" Canvas.Top="9" Canvas.Left="9">
<Image Source="/Resources/new-icons/checked-white.png" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="24" Height="24" Margin="0,0,0,0"/>
</Viewbox>
</Canvas>
</Border>
<Border x:Name="HighlighterPenPenColorPurple" BorderBrush="#e9d5ff" BorderThickness="1.5" CornerRadius="100" Width="45" MouseUp="BtnHighlighterColorPurple_Click">
<Canvas>
<Image Source="/Resources/Icons-png/transparent-grid.png" Width="42" Height="42">
<Image.Clip>
<EllipseGeometry Center="21,21" RadiusX="21" RadiusY="21" />
</Image.Clip>
</Image>
<Border Background="#a855f7" Width="42" Height="42" CornerRadius="21" Opacity="0.75"></Border>
<Viewbox Name="HighlighterPenViewboxBtnColorPurpleContent" Visibility="Visible" Canvas.Top="9" Canvas.Left="9">
<Image Source="/Resources/new-icons/checked-white.png" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="24" Height="24" Margin="0,0,0,0"/>
</Viewbox>
</Canvas>
</Border>
<Border x:Name="HighlighterPenColorTeal" BorderBrush="#99f6e4" BorderThickness="1.5" CornerRadius="100" Width="45" MouseUp="BtnHighlighterColorTeal_Click">
<Canvas>
<Image Source="/Resources/Icons-png/transparent-grid.png" Width="42" Height="42">
<Image.Clip>
<EllipseGeometry Center="21,21" RadiusX="21" RadiusY="21" />
</Image.Clip>
</Image>
<Border Background="#14b8a6" Width="42" Height="42" CornerRadius="21" Opacity="0.75"></Border>
<Viewbox Name="HighlighterPenViewboxBtnColorTealContent" Visibility="Visible" Canvas.Top="9" Canvas.Left="9">
<Image Source="/Resources/new-icons/checked-black.png" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="24" Height="24" Margin="0,0,0,0"/>
</Viewbox>
</Canvas>
</Border>
<Border x:Name="HighlighterPenColorOrange" BorderBrush="#fed7aa" BorderThickness="1.5" CornerRadius="100" Width="45" MouseUp="BtnHighlighterColorOrange_Click">
<Canvas>
<Image Source="/Resources/Icons-png/transparent-grid.png" Width="42" Height="42">
<Image.Clip>
<EllipseGeometry Center="21,21" RadiusX="21" RadiusY="21" />
</Image.Clip>
</Image>
<Border Background="#f97316" Width="42" Height="42" CornerRadius="21" Opacity="0.75"></Border>
<Viewbox Name="HighlighterPenViewboxBtnColorOrangeContent" Visibility="Visible" Canvas.Top="9" Canvas.Left="9">
<Image Source="/Resources/new-icons/checked-white.png" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="24" Height="24" Margin="0,0,0,0"/>
</Viewbox>
</Canvas>
</Border>
</Controls:UniformGrid>
</ui:SimpleStackPanel>
</Controls:UniformGrid>
</Border>
</ui:SimpleStackPanel>
</Viewbox>
</ui:SimpleStackPanel>
</Border>
</Grid>
@ -1779,7 +1978,7 @@
</ui:SimpleStackPanel>
<Grid Width="0">
<Border x:Name="BorderDrawShape" Visibility="Visible" Background="White" Opacity="0.9" BorderBrush="{DynamicResource FloatBarBorderBrush}" BorderThickness="1"
<Border x:Name="BorderDrawShape" Background="White" Opacity="1" Visibility="Visible" BorderBrush="{DynamicResource FloatBarBorderBrush}" BorderThickness="1"
CornerRadius="5" Margin="-200,-122,-117,37">
<ui:SimpleStackPanel Spacing="0" Orientation="Vertical">
<!--<TextBlock FontSize="16" Foreground="{DynamicResource FloatBarForeground}" HorizontalAlignment="Left" Margin="10,8">
@ -1789,7 +1988,10 @@
<ui:SymbolIcon Margin="0,-20,8,15" Symbol="Pin" MouseDown="Border_MouseDown" MouseUp="SymbolIconPinBorderDrawShape_MouseUp" Foreground="{DynamicResource FloatBarForeground}" HorizontalAlignment="Right"/>-->
<Border BorderBrush="#1e3a8a" BorderThickness="0,0,0,1" CornerRadius="8,8,0,0" Background="#2563eb" Margin="-1,-1,-1,0" Padding="1,1,1,0">
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
<TextBlock Text="几何绘图BETA" Foreground="White" Padding="8,5,44,5" FontSize="11" FontWeight="Bold" TextAlignment="Center"/>
<Canvas Height="24" Width="315" ClipToBounds="True">
<Image Source="/Resources/new-icons/osu-lazer-triangles.png" Width="64" Canvas.Right="-20" Canvas.Bottom="-10" Opacity="0.5" />
<TextBlock Text="几何绘图" Canvas.Left="8" Foreground="White" Padding="0,5" FontSize="11" FontWeight="Bold" TextAlignment="Center"/>
</Canvas>
</ui:SimpleStackPanel>
</Border>
<ui:SimpleStackPanel Orientation="Horizontal" Height="38" Spacing="2" Margin="4,6,4,0">
@ -1916,10 +2118,13 @@
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
<Grid Width="0">
<Border ClipToBounds="True" Name="EraserSizePanel" Margin="-203,-87,98,37" CornerRadius="5" Background="#fafafa" Opacity="1" BorderBrush="{DynamicResource FloatBarBorderBrush}" BorderThickness="1">
<Border Visibility="Visible" ClipToBounds="True" Name="EraserSizePanel" Margin="-203,-128,83,37" CornerRadius="5" Background="#fafafa" Opacity="1" BorderBrush="{DynamicResource FloatBarBorderBrush}" BorderThickness="1">
<ui:SimpleStackPanel Margin="0">
<Border BorderBrush="#1e3a8a" BorderThickness="0,0,0,1" CornerRadius="6,6,0,0" Background="#2563eb" Margin="-1,-1,-1,1">
<TextBlock Text="橡皮选项" Foreground="White" Padding="0,5" FontSize="11" FontWeight="Bold" TextAlignment="Center"/>
<Canvas Height="24" ClipToBounds="True">
<Image Source="/Resources/new-icons/osu-lazer-triangles.png" Width="64" Canvas.Right="-20" Canvas.Bottom="-10" Opacity="0.5" />
<TextBlock Text="橡皮选项" Canvas.Left="8" Foreground="White" Padding="0,5" FontSize="11" FontWeight="Bold" TextAlignment="Center"/>
</Canvas>
</Border>
<ui:SimpleStackPanel Orientation="Horizontal" Margin="0,8,0,0" Spacing="-2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Label Margin="0,0,0,0" Content="大小" FontWeight="Bold" Foreground="{DynamicResource FloatBarForeground}" FontSize="10" VerticalAlignment="Center"/>
@ -1933,6 +2138,33 @@
</ComboBox>
</Viewbox>
</ui:SimpleStackPanel>
<TextBlock HorizontalAlignment="Center" Margin="0,12,0,6" Text="橡皮形状" FontWeight="Bold" Foreground="{DynamicResource FloatBarForeground}" FontSize="10" VerticalAlignment="Center"/>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,0" Spacing="4">
<Border x:Name="CircleEraserTabButton" MouseDown="SwitchToCircleEraser" Background="#553b82f6" Height="20" Width="40" CornerRadius="3">
<Canvas>
<ui:SimpleStackPanel x:Name="CircleEraserTabButtonIndicator" Visibility="Visible" Orientation="Horizontal" Canvas.Left="11" Canvas.Right="11" Canvas.Bottom="0">
<Border Width="18" Height="2" Background="#2563eb" CornerRadius="1"></Border>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Vertical" Height="20" Width="40">
<ui:SimpleStackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,3">
<TextBlock x:Name="CircleEraserTabButtonText" Foreground="#172554" FontWeight="Medium" FontSize="9" TextAlignment="Center" Text="圆形擦" Margin="2,1,0,0"/>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
</Canvas>
</Border>
<Border x:Name="RectangleEraserTabButton" MouseDown="SwitchToRectangleEraser" Background="Transparent" Height="20" Width="40" CornerRadius="3">
<Canvas>
<ui:SimpleStackPanel Visibility="Collapsed" x:Name="RectangleEraserTabButtonIndicator" Orientation="Horizontal" Canvas.Left="11" Canvas.Right="11" Canvas.Bottom="0">
<Border Width="18" Height="2" Background="#2563eb" CornerRadius="1"></Border>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Vertical" Height="20" Width="40">
<ui:SimpleStackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,3">
<TextBlock x:Name="RectangleEraserTabButtonText" Foreground="#172554" FontWeight="Medium" FontSize="9" TextAlignment="Center" Text="黑板擦" Margin="2,1,0,0"/>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
</Canvas>
</Border>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
</Border>
</Grid>
@ -2024,7 +2256,10 @@
<Border ClipToBounds="True" Name="TwoFingerGestureBorder" Margin="-86,-111,-33,40" CornerRadius="5" Background="#fafafa" Opacity="1" BorderBrush="{DynamicResource FloatBarBorderBrush}" BorderThickness="1">
<ui:SimpleStackPanel Margin="0">
<Border BorderBrush="#1e3a8a" BorderThickness="0,0,0,1" CornerRadius="6,6,0,0" Background="#2563eb" Margin="-1,-1,-1,1">
<TextBlock Text="手势选项" Foreground="White" Padding="0,5" FontSize="11" FontWeight="Bold" TextAlignment="Center"/>
<Canvas Height="24" ClipToBounds="True">
<Image Source="/Resources/new-icons/osu-lazer-triangles.png" Width="64" Canvas.Right="-20" Canvas.Bottom="-10" Opacity="0.5" />
<TextBlock Text="手势选项" Canvas.Left="8" Foreground="White" Padding="0,5" FontSize="11" FontWeight="Bold" TextAlignment="Center"/>
</Canvas>
</Border>
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="4" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,3,0,0">
<Image Source="/Resources/new-icons/multi-touch.png" RenderOptions.BitmapScalingMode="HighQuality" Height="16" Width="16"/>

View File

@ -81,6 +81,7 @@ namespace Ink_Canvas {
}
CheckColorTheme(true);
CheckPenTypeUIState();
}
#endregion
@ -211,5 +212,6 @@ namespace Ink_Canvas {
}
#endregion Definations and Loading
}
}

View File

@ -0,0 +1,627 @@
using Ink_Canvas.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Ink;
using System.Windows.Media.Imaging;
using System.Windows.Media;
using System.Windows;
using System.Windows.Input;
namespace Ink_Canvas
{
public partial class MainWindow : Window
{
int inkColor = 1;
private void ColorSwitchCheck()
{
HideSubPanels("color");
if (Main_Grid.Background == Brushes.Transparent)
{
if (currentMode == 1)
{
currentMode = 0;
GridBackgroundCover.Visibility = Visibility.Collapsed;
AnimationsHelper.HideWithSlideAndFade(BlackboardLeftSide);
AnimationsHelper.HideWithSlideAndFade(BlackboardCenterSide);
AnimationsHelper.HideWithSlideAndFade(BlackboardRightSide);
}
BtnHideInkCanvas_Click(BtnHideInkCanvas, null);
}
StrokeCollection strokes = inkCanvas.GetSelectedStrokes();
if (strokes.Count != 0)
{
foreach (Stroke stroke in strokes)
{
try
{
stroke.DrawingAttributes.Color = inkCanvas.DefaultDrawingAttributes.Color;
}
catch { }
}
}
else
{
inkCanvas.IsManipulationEnabled = true;
drawingShapeMode = 0;
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
CancelSingleFingerDragMode();
forceEraser = false;
CheckColorTheme();
}
isLongPressSelected = false;
}
bool isUselightThemeColor = false, isDesktopUselightThemeColor = false;
int penType = 0; // 0是签字笔1是荧光笔
int lastDesktopInkColor = 1, lastBoardInkColor = 5;
int highlighterColor = 102;
private void CheckColorTheme(bool changeColorTheme = false)
{
if (changeColorTheme)
{
if (currentMode != 0)
{
if (Settings.Canvas.UsingWhiteboard)
{
GridBackgroundCover.Background = new SolidColorBrush(Color.FromRgb(234, 235, 237));
WaterMarkTime.Foreground = new SolidColorBrush(Color.FromRgb(22, 41, 36));
WaterMarkDate.Foreground = new SolidColorBrush(Color.FromRgb(22, 41, 36));
BlackBoardWaterMark.Foreground = new SolidColorBrush(Color.FromRgb(22, 41, 36));
isUselightThemeColor = false;
}
else
{
GridBackgroundCover.Background = new SolidColorBrush(Color.FromRgb(22, 41, 36));
WaterMarkTime.Foreground = new SolidColorBrush(Color.FromRgb(234, 235, 237));
WaterMarkDate.Foreground = new SolidColorBrush(Color.FromRgb(234, 235, 237));
BlackBoardWaterMark.Foreground = new SolidColorBrush(Color.FromRgb(234, 235, 237));
isUselightThemeColor = true;
}
}
}
if (currentMode == 0)
{
isUselightThemeColor = isDesktopUselightThemeColor;
inkColor = lastDesktopInkColor;
}
else
{
inkColor = lastBoardInkColor;
}
double alpha = inkCanvas.DefaultDrawingAttributes.Color.A;
if (inkColor == 0)
{ // Black
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 0, 0, 0);
}
else if (inkColor == 5)
{ // White
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 255, 255, 255);
}
else if (penType==0)
{
if (isUselightThemeColor)
{
if (inkColor == 1)
{ // Red
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 239, 68, 68);
}
else if (inkColor == 2)
{ // Green
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 34, 197, 94);
}
else if (inkColor == 3)
{ // Blue
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 59, 130, 246);
}
else if (inkColor == 4)
{ // Yellow
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 250, 204, 21);
}
else if (inkColor == 6)
{ // Pink
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 236, 72, 153);
}
else if (inkColor == 7)
{ // Teal (亮色)
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 20, 184, 166);
}
else if (inkColor == 8)
{ // Orange (亮色)
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 249, 115, 22);
}
}
else
{
if (inkColor == 1)
{ // Red
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 220, 38, 38);
}
else if (inkColor == 2)
{ // Green
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 22, 163, 74);
}
else if (inkColor == 3)
{ // Blue
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 37, 99, 235);
}
else if (inkColor == 4)
{ // Yellow
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 234, 179, 8);
}
else if (inkColor == 6)
{ // Pink ( Purple )
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 147, 51, 234);
}
else if (inkColor == 7)
{ // Teal (暗色)
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 13, 148, 136);
}
else if (inkColor == 8)
{ // Orange (暗色)
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 234, 88, 12);
}
}
} else if (penType==1)
{
if (highlighterColor == 100)
{ // Black
inkCanvas.DefaultDrawingAttributes.Color = Color.FromRgb(0,0,0);
}
else if (highlighterColor == 101)
{ // White
inkCanvas.DefaultDrawingAttributes.Color = Color.FromRgb(250, 250, 250);
}
else if (highlighterColor == 102)
{ // Red
inkCanvas.DefaultDrawingAttributes.Color = Color.FromRgb(239, 68, 68);
}
else if (highlighterColor == 103)
{ // Yellow
inkCanvas.DefaultDrawingAttributes.Color = Color.FromRgb(253, 224, 71);
}
else if (highlighterColor == 104)
{ // Green
inkCanvas.DefaultDrawingAttributes.Color = Color.FromRgb(74, 222, 128);
}
else if (highlighterColor == 105)
{ // Zinc
inkCanvas.DefaultDrawingAttributes.Color = Color.FromRgb(113, 113, 122);
}
else if (highlighterColor == 106)
{ // Blue
inkCanvas.DefaultDrawingAttributes.Color = Color.FromRgb(59, 130, 246);
}
else if (highlighterColor == 107)
{ // Purple
inkCanvas.DefaultDrawingAttributes.Color = Color.FromRgb(168, 85, 247);
}
else if (highlighterColor == 108)
{ // teal
inkCanvas.DefaultDrawingAttributes.Color = Color.FromRgb(45, 212, 191);
}
else if (highlighterColor == 109)
{ // Orange
inkCanvas.DefaultDrawingAttributes.Color = Color.FromRgb(249, 115, 22);
}
}
if (isUselightThemeColor)
{ // 亮系
// 亮色的红色
BorderPenColorRed.Background = new SolidColorBrush(Color.FromRgb(239, 68, 68));
BoardBorderPenColorRed.Background = new SolidColorBrush(Color.FromRgb(239, 68, 68));
// 亮色的绿色
BorderPenColorGreen.Background = new SolidColorBrush(Color.FromRgb(34, 197, 94));
BoardBorderPenColorGreen.Background = new SolidColorBrush(Color.FromRgb(34, 197, 94));
// 亮色的蓝色
BorderPenColorBlue.Background = new SolidColorBrush(Color.FromRgb(59, 130, 246));
BoardBorderPenColorBlue.Background = new SolidColorBrush(Color.FromRgb(59, 130, 246));
// 亮色的黄色
BorderPenColorYellow.Background = new SolidColorBrush(Color.FromRgb(250, 204, 21));
BoardBorderPenColorYellow.Background = new SolidColorBrush(Color.FromRgb(250, 204, 21));
// 亮色的粉色
BorderPenColorPink.Background = new SolidColorBrush(Color.FromRgb(236, 72, 153));
BoardBorderPenColorPink.Background = new SolidColorBrush(Color.FromRgb(236, 72, 153));
// 亮色的Teal
BorderPenColorTeal.Background = new SolidColorBrush(Color.FromRgb(20, 184, 166));
// 亮色的Orange
BorderPenColorOrange.Background = new SolidColorBrush(Color.FromRgb(249, 115, 22));
BitmapImage newImageSource = new BitmapImage();
newImageSource.BeginInit();
newImageSource.UriSource = new Uri("/Resources/Icons-Fluent/ic_fluent_weather_moon_24_regular.png", UriKind.RelativeOrAbsolute);
newImageSource.EndInit();
ColorThemeSwitchIcon.Source = newImageSource;
BoardColorThemeSwitchIcon.Source = newImageSource;
ColorThemeSwitchTextBlock.Text = "暗系";
BoardColorThemeSwitchTextBlock.Text = "暗系";
}
else
{ // 暗系
// 暗色的红色
BorderPenColorRed.Background = new SolidColorBrush(Color.FromRgb(220, 38, 38));
BoardBorderPenColorRed.Background = new SolidColorBrush(Color.FromRgb(220, 38, 38));
// 暗色的绿色
BorderPenColorGreen.Background = new SolidColorBrush(Color.FromRgb(22, 163, 74));
BoardBorderPenColorGreen.Background = new SolidColorBrush(Color.FromRgb(22, 163, 74));
// 暗色的蓝色
BorderPenColorBlue.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235));
BoardBorderPenColorBlue.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235));
// 暗色的黄色
BorderPenColorYellow.Background = new SolidColorBrush(Color.FromRgb(234, 179, 8));
BoardBorderPenColorYellow.Background = new SolidColorBrush(Color.FromRgb(234, 179, 8));
// 暗色的紫色对应亮色的粉色
BorderPenColorPink.Background = new SolidColorBrush(Color.FromRgb(147, 51, 234));
BoardBorderPenColorPink.Background = new SolidColorBrush(Color.FromRgb(147, 51, 234));
// 暗色的Teal
BorderPenColorTeal.Background = new SolidColorBrush(Color.FromRgb(13, 148, 136));
// 暗色的Orange
BorderPenColorOrange.Background = new SolidColorBrush(Color.FromRgb(234, 88, 12));
BitmapImage newImageSource = new BitmapImage();
newImageSource.BeginInit();
newImageSource.UriSource = new Uri("/Resources/Icons-Fluent/ic_fluent_weather_sunny_24_regular.png", UriKind.RelativeOrAbsolute);
newImageSource.EndInit();
ColorThemeSwitchIcon.Source = newImageSource;
BoardColorThemeSwitchIcon.Source = newImageSource;
ColorThemeSwitchTextBlock.Text = "亮系";
BoardColorThemeSwitchTextBlock.Text = "亮系";
}
// 改变选中提示
ViewboxBtnColorBlackContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorBlueContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorGreenContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorRedContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorYellowContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorWhiteContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorPinkContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorTealContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorOrangeContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorBlackContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorBlueContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorGreenContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorRedContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorYellowContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorWhiteContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorPinkContent.Visibility = Visibility.Collapsed;
HighlighterPenViewboxBtnColorBlackContent.Visibility = Visibility.Collapsed;
HighlighterPenViewboxBtnColorBlueContent.Visibility= Visibility.Collapsed;
HighlighterPenViewboxBtnColorGreenContent.Visibility= Visibility.Collapsed;
HighlighterPenViewboxBtnColorOrangeContent.Visibility= Visibility.Collapsed;
HighlighterPenViewboxBtnColorPurpleContent.Visibility= Visibility.Collapsed;
HighlighterPenViewboxBtnColorRedContent.Visibility= Visibility.Collapsed;
HighlighterPenViewboxBtnColorTealContent.Visibility=Visibility.Collapsed;
HighlighterPenViewboxBtnColorWhiteContent.Visibility= Visibility.Collapsed;
HighlighterPenViewboxBtnColorYellowContent.Visibility=Visibility.Collapsed;
HighlighterPenViewboxBtnColorZincContent.Visibility=Visibility.Collapsed;
switch (inkColor)
{
case 0:
ViewboxBtnColorBlackContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorBlackContent.Visibility = Visibility.Visible;
break;
case 1:
ViewboxBtnColorRedContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorRedContent.Visibility = Visibility.Visible;
break;
case 2:
ViewboxBtnColorGreenContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorGreenContent.Visibility = Visibility.Visible;
break;
case 3:
ViewboxBtnColorBlueContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorBlueContent.Visibility = Visibility.Visible;
break;
case 4:
ViewboxBtnColorYellowContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorYellowContent.Visibility = Visibility.Visible;
break;
case 5:
ViewboxBtnColorWhiteContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorWhiteContent.Visibility = Visibility.Visible;
break;
case 6:
ViewboxBtnColorPinkContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorPinkContent.Visibility = Visibility.Visible;
break;
case 7:
ViewboxBtnColorTealContent.Visibility = Visibility.Visible;
break;
case 8:
ViewboxBtnColorOrangeContent.Visibility = Visibility.Visible;
break;
}
switch (highlighterColor)
{
case 100:
HighlighterPenViewboxBtnColorBlackContent.Visibility = Visibility.Visible;
break;
case 101:
HighlighterPenViewboxBtnColorWhiteContent.Visibility = Visibility.Visible;
break;
case 102:
HighlighterPenViewboxBtnColorRedContent.Visibility = Visibility.Visible;
break;
case 103:
HighlighterPenViewboxBtnColorYellowContent.Visibility = Visibility.Visible;
break;
case 104:
HighlighterPenViewboxBtnColorGreenContent.Visibility = Visibility.Visible;
break;
case 105:
HighlighterPenViewboxBtnColorZincContent.Visibility = Visibility.Visible;
break;
case 106:
HighlighterPenViewboxBtnColorBlueContent.Visibility = Visibility.Visible;
break;
case 107:
HighlighterPenViewboxBtnColorPurpleContent.Visibility = Visibility.Visible;
break;
case 108:
HighlighterPenViewboxBtnColorTealContent.Visibility = Visibility.Visible;
break;
case 109:
HighlighterPenViewboxBtnColorOrangeContent.Visibility = Visibility.Visible;
break;
}
}
private void CheckLastColor(int inkColor, bool isHighlighter = false)
{
if (isHighlighter==true)
{
highlighterColor = inkColor;
} else
{
if (currentMode == 0) lastDesktopInkColor = inkColor;
else lastBoardInkColor = inkColor;
}
}
private void CheckPenTypeUIState()
{
if (penType==0)
{
DefaultPenPropsPanel.Visibility = Visibility.Visible;
DefaultPenColorsPanel.Visibility = Visibility.Visible;
HighlighterPenColorsPanel.Visibility = Visibility.Collapsed;
HighlighterPenPropsPanel.Visibility = Visibility.Collapsed;
PenPalette.Margin = new Thickness(-160, -200, -33, 32);
DefaultPenTabButton.Opacity = 1;
DefaultPenTabButtonText.FontWeight = FontWeights.Bold;
DefaultPenTabButtonText.Margin = new Thickness(2, 0.5, 0, 0);
DefaultPenTabButtonText.FontSize = 9.5;
DefaultPenTabButton.Background = new SolidColorBrush(Color.FromArgb(72, 219, 234, 254));
DefaultPenTabButtonIndicator.Visibility = Visibility.Visible;
HighlightPenTabButton.Opacity = 0.9;
HighlightPenTabButtonText.FontWeight = FontWeights.Normal;
HighlightPenTabButtonText.FontSize = 9;
HighlightPenTabButtonText.Margin = new Thickness(2, 1, 0, 0);
HighlightPenTabButton.Background = new SolidColorBrush(Colors.Transparent);
HighlightPenTabButtonIndicator.Visibility = Visibility.Collapsed;
} else if (penType==1)
{
DefaultPenPropsPanel.Visibility = Visibility.Collapsed;
DefaultPenColorsPanel.Visibility = Visibility.Collapsed;
HighlighterPenColorsPanel.Visibility = Visibility.Visible;
HighlighterPenPropsPanel.Visibility = Visibility.Visible;
PenPalette.Margin = new Thickness(-160, -157, -33, 32);
DefaultPenTabButton.Opacity = 0.9;
DefaultPenTabButtonText.FontWeight = FontWeights.Normal;
DefaultPenTabButtonText.FontSize = 9;
DefaultPenTabButtonText.Margin = new Thickness(2, 1, 0, 0);
DefaultPenTabButton.Background = new SolidColorBrush(Colors.Transparent);
DefaultPenTabButtonIndicator.Visibility = Visibility.Collapsed;
HighlightPenTabButton.Opacity = 1;
HighlightPenTabButtonText.FontWeight = FontWeights.Bold;
HighlightPenTabButtonText.FontSize = 9.5;
HighlightPenTabButtonText.Margin = new Thickness(2, 0.5, 0, 0);
HighlightPenTabButton.Background = new SolidColorBrush(Color.FromArgb(72, 219, 234, 254));
HighlightPenTabButtonIndicator.Visibility = Visibility.Visible;
}
}
private void SwitchToDefaultPen(object sender, MouseButtonEventArgs e)
{
penType = 0;
CheckPenTypeUIState();
CheckColorTheme();
drawingAttributes.Width = Settings.Canvas.InkWidth;
drawingAttributes.Height = Settings.Canvas.InkWidth;
drawingAttributes.StylusTip = StylusTip.Ellipse;
drawingAttributes.IsHighlighter = false;
}
private void SwitchToHighlighterPen(object sender, MouseButtonEventArgs e)
{
penType = 1;
CheckPenTypeUIState();
CheckColorTheme();
drawingAttributes.Width = Settings.Canvas.HighlighterWidth/2;
drawingAttributes.Height = Settings.Canvas.HighlighterWidth;
drawingAttributes.StylusTip = StylusTip.Rectangle;
drawingAttributes.IsHighlighter = true;
}
private void BtnColorBlack_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(0);
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorRed_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(1);
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorGreen_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(2);
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorBlue_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(3);
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorYellow_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(4);
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorWhite_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(5);
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorPink_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(6);
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorOrange_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(8);
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorTeal_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(7);
forceEraser = false;
ColorSwitchCheck();
}
private void BtnHighlighterColorBlack_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(100,true);
penType = 1;
forceEraser = false;
CheckPenTypeUIState();
ColorSwitchCheck();
}
private void BtnHighlighterColorWhite_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(101, true);
penType = 1;
forceEraser = false;
CheckPenTypeUIState();
ColorSwitchCheck();
}
private void BtnHighlighterColorRed_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(102, true);
penType = 1;
forceEraser = false;
CheckPenTypeUIState();
ColorSwitchCheck();
}
private void BtnHighlighterColorYellow_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(103, true);
penType = 1;
forceEraser = false;
CheckPenTypeUIState();
ColorSwitchCheck();
}
private void BtnHighlighterColorGreen_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(104, true);
penType = 1;
forceEraser = false;
CheckPenTypeUIState();
ColorSwitchCheck();
}
private void BtnHighlighterColorZinc_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(105, true);
penType = 1;
forceEraser = false;
CheckPenTypeUIState();
ColorSwitchCheck();
}
private void BtnHighlighterColorBlue_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(106, true);
penType = 1;
forceEraser = false;
CheckPenTypeUIState();
ColorSwitchCheck();
}
private void BtnHighlighterColorPurple_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(107, true);
penType = 1;
forceEraser = false;
CheckPenTypeUIState();
ColorSwitchCheck();
}
private void BtnHighlighterColorTeal_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(108, true);
penType = 1;
forceEraser = false;
CheckPenTypeUIState();
ColorSwitchCheck();
}
private void BtnHighlighterColorOrange_Click(object sender, RoutedEventArgs e)
{
CheckLastColor(109, true);
penType = 1;
forceEraser = false;
CheckPenTypeUIState();
ColorSwitchCheck();
}
private Color StringToColor(string colorStr)
{
Byte[] argb = new Byte[4];
for (int i = 0; i < 4; i++)
{
char[] charArray = colorStr.Substring(i * 2 + 1, 2).ToCharArray();
Byte b1 = toByte(charArray[0]);
Byte b2 = toByte(charArray[1]);
argb[i] = (Byte)(b2 | (b1 << 4));
}
return Color.FromArgb(argb[0], argb[1], argb[2], argb[3]);//#FFFFFFFF
}
private static byte toByte(char c)
{
byte b = (byte)"0123456789ABCDEF".IndexOf(c);
return b;
}
}
}

View File

@ -20,12 +20,16 @@ using System.IO;
using System.Windows.Media.Effects;
using static System.Net.Mime.MediaTypeNames;
using System.Text;
using System.Globalization;
using System.Windows.Data;
namespace Ink_Canvas {
public partial class MainWindow : Window {
#region TwoFingZoomBtn
private void TwoFingerGestureBorder_MouseUp(object sender, RoutedEventArgs e) {
FloatingBarIcons_MouseUp_New(sender);
if (TwoFingerGestureBorder.Visibility == Visibility.Visible) {
@ -484,6 +488,7 @@ namespace Ink_Canvas {
});
})).Start();
SwitchToDefaultPen(null, null);
CheckColorTheme(true);
}
@ -510,6 +515,39 @@ namespace Ink_Canvas {
new RandWindow().Show();
}
public void CheckEraserTypeTab()
{
if (Settings.Canvas.EraserShapeType==0)
{
CircleEraserTabButton.Background = new SolidColorBrush(Color.FromArgb(85, 59, 130, 246));
CircleEraserTabButton.Opacity = 1;
CircleEraserTabButtonText.FontWeight = FontWeights.Bold;
CircleEraserTabButtonText.Margin = new Thickness(2, 0.5, 0, 0);
CircleEraserTabButtonText.FontSize = 9.5;
CircleEraserTabButtonIndicator.Visibility = Visibility.Visible;
RectangleEraserTabButton.Background = new SolidColorBrush(Colors.Transparent);
RectangleEraserTabButton.Opacity = 0.75;
RectangleEraserTabButtonText.FontWeight = FontWeights.Normal;
RectangleEraserTabButtonText.FontSize = 9;
RectangleEraserTabButtonText.Margin = new Thickness(2, 1, 0, 0);
RectangleEraserTabButtonIndicator.Visibility = Visibility.Collapsed;
} else
{
RectangleEraserTabButton.Background = new SolidColorBrush(Color.FromArgb(85, 59, 130, 246));
RectangleEraserTabButton.Opacity = 1;
RectangleEraserTabButtonText.FontWeight = FontWeights.Bold;
RectangleEraserTabButtonText.Margin = new Thickness(2, 0.5, 0, 0);
RectangleEraserTabButtonText.FontSize = 9.5;
RectangleEraserTabButtonIndicator.Visibility = Visibility.Visible;
CircleEraserTabButton.Background = new SolidColorBrush(Colors.Transparent);
CircleEraserTabButton.Opacity = 0.75;
CircleEraserTabButtonText.FontWeight = FontWeights.Normal;
CircleEraserTabButtonText.FontSize = 9;
CircleEraserTabButtonText.Margin = new Thickness(2, 1, 0, 0);
CircleEraserTabButtonIndicator.Visibility = Visibility.Collapsed;
}
}
private void SymbolIconRandOne_MouseUp(object sender, MouseButtonEventArgs e) {
if (lastBorderMouseDownObject != sender) return;
@ -831,22 +869,46 @@ namespace Ink_Canvas {
FloatingBarIcons_MouseUp_New(sender);
forceEraser = true;
forcePointEraser = true;
double k = 1;
switch (Settings.Canvas.EraserSize) {
case 0:
k = 0.5;
break;
case 1:
k = 0.8;
break;
case 3:
k = 1.25;
break;
case 4:
k = 1.8;
break;
if (Settings.Canvas.EraserShapeType == 0)
{
double k = 1;
switch (Settings.Canvas.EraserSize)
{
case 0:
k = 0.5;
break;
case 1:
k = 0.8;
break;
case 3:
k = 1.25;
break;
case 4:
k = 1.8;
break;
}
inkCanvas.EraserShape = new EllipseStylusShape(k * 90, k * 90);
}
else if (Settings.Canvas.EraserShapeType == 1)
{
double k = 1;
switch (Settings.Canvas.EraserSize)
{
case 0:
k = 0.7;
break;
case 1:
k = 0.9;
break;
case 3:
k = 1.2;
break;
case 4:
k = 1.6;
break;
}
inkCanvas.EraserShape = new RectangleStylusShape(k * 90 * 0.6, k * 90);
}
inkCanvas.EraserShape = new EllipseStylusShape(k * 90, k * 90);
if (inkCanvas.EditingMode == InkCanvasEditingMode.EraseByPoint)
{
@ -1190,12 +1252,17 @@ namespace Ink_Canvas {
inkCanvas.Children.Clear();
CancelSingleFingerDragMode();
if (Settings.Canvas.ClearCanvasAndClearTimeMachine)
{
timeMachine.ClearStrokeHistory();
}
}
bool lastIsInMultiTouchMode = false;
private void CancelSingleFingerDragMode()
{
if (ToggleSwitchDrawShapeBorderAutoHide.IsOn) {
bool lastIsInMultiTouchMode = false;
private void CancelSingleFingerDragMode()
{
if (ToggleSwitchDrawShapeBorderAutoHide.IsOn) {
CollapseBorderDrawShape();
}
@ -1205,7 +1272,7 @@ namespace Ink_Canvas {
BtnFingerDragMode_Click(BtnFingerDragMode, null);
}
isLongPressSelected = false;
}
}
private void BtnHideControl_Click(object sender, RoutedEventArgs e) {
if (StackPanelControl.Visibility == Visibility.Visible) {
@ -1423,341 +1490,5 @@ namespace Ink_Canvas {
#endregion
#region Right Side Panel (Buttons - Color)
int inkColor = 1;
private void ColorSwitchCheck() {
HideSubPanels("color");
if (Main_Grid.Background == Brushes.Transparent) {
if (currentMode == 1) {
currentMode = 0;
GridBackgroundCover.Visibility = Visibility.Collapsed;
AnimationsHelper.HideWithSlideAndFade(BlackboardLeftSide);
AnimationsHelper.HideWithSlideAndFade(BlackboardCenterSide);
AnimationsHelper.HideWithSlideAndFade(BlackboardRightSide);
}
BtnHideInkCanvas_Click(BtnHideInkCanvas, null);
}
StrokeCollection strokes = inkCanvas.GetSelectedStrokes();
if (strokes.Count != 0) {
foreach (Stroke stroke in strokes) {
try {
stroke.DrawingAttributes.Color = inkCanvas.DefaultDrawingAttributes.Color;
} catch { }
}
} else {
inkCanvas.IsManipulationEnabled = true;
drawingShapeMode = 0;
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
CancelSingleFingerDragMode();
forceEraser = false;
CheckColorTheme();
}
isLongPressSelected = false;
}
bool isUselightThemeColor = false, isDesktopUselightThemeColor = false;
int lastDesktopInkColor = 1, lastBoardInkColor = 5;
private void CheckColorTheme(bool changeColorTheme = false) {
if (changeColorTheme) {
if (currentMode != 0) {
if (Settings.Canvas.UsingWhiteboard) {
GridBackgroundCover.Background = new SolidColorBrush(Color.FromRgb(234,235,237));
WaterMarkTime.Foreground= new SolidColorBrush(Color.FromRgb(22, 41, 36));
WaterMarkDate.Foreground= new SolidColorBrush(Color.FromRgb(22, 41, 36));
BlackBoardWaterMark.Foreground = new SolidColorBrush(Color.FromRgb(22, 41, 36));
isUselightThemeColor = false;
} else {
GridBackgroundCover.Background = new SolidColorBrush(Color.FromRgb(22,41,36));
WaterMarkTime.Foreground = new SolidColorBrush(Color.FromRgb(234, 235, 237));
WaterMarkDate.Foreground = new SolidColorBrush(Color.FromRgb(234, 235, 237));
BlackBoardWaterMark.Foreground = new SolidColorBrush(Color.FromRgb(234, 235, 237));
isUselightThemeColor = true;
}
}
}
if (currentMode == 0) {
isUselightThemeColor = isDesktopUselightThemeColor;
inkColor = lastDesktopInkColor;
} else {
inkColor = lastBoardInkColor;
}
double alpha = inkCanvas.DefaultDrawingAttributes.Color.A;
if (inkColor == 0) { // Black
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha,0,0,0);
} else if (inkColor == 5) { // White
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 255, 255, 255);
} else if (isUselightThemeColor) {
if (inkColor == 1) { // Red
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 239,68,68);
} else if (inkColor == 2) { // Green
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 34,197,94);
} else if (inkColor == 3) { // Blue
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 59, 130, 246);
} else if (inkColor == 4) { // Yellow
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 250, 204, 21);
} else if (inkColor == 6) { // Pink
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 236, 72, 153);
} else if (inkColor == 7) { // Teal (亮色)
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 20, 184, 166);
} else if (inkColor == 8) { // Orange (亮色)
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 249, 115, 22);
}
} else {
if (inkColor == 1) { // Red
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 220, 38, 38);
} else if (inkColor == 2) { // Green
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 22, 163, 74);
} else if (inkColor == 3) { // Blue
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 37, 99, 235);
} else if (inkColor == 4) { // Yellow
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 234, 179, 8);
} else if (inkColor == 6) { // Pink ( Purple )
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 147, 51, 234);
} else if (inkColor == 7) { // Teal (暗色)
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 13, 148, 136);
} else if (inkColor == 8) { // Orange (暗色)
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 234, 88, 12);
}
}
if (isUselightThemeColor) { // 亮系
// 亮色的红色
BorderPenColorRed.Background = new SolidColorBrush(Color.FromRgb(239, 68, 68));
BoardBorderPenColorRed.Background = new SolidColorBrush(Color.FromRgb(239, 68, 68));
// 亮色的绿色
BorderPenColorGreen.Background = new SolidColorBrush(Color.FromRgb(34, 197, 94));
BoardBorderPenColorGreen.Background = new SolidColorBrush(Color.FromRgb(34, 197, 94));
// 亮色的蓝色
BorderPenColorBlue.Background = new SolidColorBrush(Color.FromRgb(59, 130, 246));
BoardBorderPenColorBlue.Background = new SolidColorBrush(Color.FromRgb(59, 130, 246));
// 亮色的黄色
BorderPenColorYellow.Background = new SolidColorBrush(Color.FromRgb(250, 204, 21));
BoardBorderPenColorYellow.Background = new SolidColorBrush(Color.FromRgb(250, 204, 21));
// 亮色的粉色
BorderPenColorPink.Background = new SolidColorBrush(Color.FromRgb(236, 72, 153));
BoardBorderPenColorPink.Background = new SolidColorBrush(Color.FromRgb(236, 72, 153));
// 亮色的Teal
BorderPenColorTeal.Background = new SolidColorBrush(Color.FromRgb(20, 184, 166));
// 亮色的Orange
BorderPenColorOrange.Background = new SolidColorBrush(Color.FromRgb(249, 115, 22));
BitmapImage newImageSource = new BitmapImage();
newImageSource.BeginInit();
newImageSource.UriSource = new Uri("/Resources/Icons-Fluent/ic_fluent_weather_moon_24_regular.png", UriKind.RelativeOrAbsolute);
newImageSource.EndInit();
ColorThemeSwitchIcon.Source = newImageSource;
BoardColorThemeSwitchIcon.Source = newImageSource;
ColorThemeSwitchTextBlock.Text = "暗系";
BoardColorThemeSwitchTextBlock.Text = "暗系";
} else { // 暗系
// 暗色的红色
BorderPenColorRed.Background = new SolidColorBrush(Color.FromRgb(220, 38, 38));
BoardBorderPenColorRed.Background = new SolidColorBrush(Color.FromRgb(220, 38, 38));
// 暗色的绿色
BorderPenColorGreen.Background = new SolidColorBrush(Color.FromRgb(22, 163, 74));
BoardBorderPenColorGreen.Background = new SolidColorBrush(Color.FromRgb(22, 163, 74));
// 暗色的蓝色
BorderPenColorBlue.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235));
BoardBorderPenColorBlue.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235));
// 暗色的黄色
BorderPenColorYellow.Background = new SolidColorBrush(Color.FromRgb(234, 179, 8));
BoardBorderPenColorYellow.Background = new SolidColorBrush(Color.FromRgb(234, 179, 8));
// 暗色的紫色对应亮色的粉色
BorderPenColorPink.Background = new SolidColorBrush(Color.FromRgb(147, 51, 234));
BoardBorderPenColorPink.Background = new SolidColorBrush(Color.FromRgb(147, 51, 234));
// 暗色的Teal
BorderPenColorTeal.Background = new SolidColorBrush(Color.FromRgb(13, 148, 136));
// 暗色的Orange
BorderPenColorOrange.Background = new SolidColorBrush(Color.FromRgb(234, 88, 12));
BitmapImage newImageSource = new BitmapImage();
newImageSource.BeginInit();
newImageSource.UriSource = new Uri("/Resources/Icons-Fluent/ic_fluent_weather_sunny_24_regular.png", UriKind.RelativeOrAbsolute);
newImageSource.EndInit();
ColorThemeSwitchIcon.Source = newImageSource;
BoardColorThemeSwitchIcon.Source = newImageSource;
ColorThemeSwitchTextBlock.Text = "亮系";
BoardColorThemeSwitchTextBlock.Text = "亮系";
}
// 改变选中提示
ViewboxBtnColorBlackContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorBlueContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorGreenContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorRedContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorYellowContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorWhiteContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorPinkContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorTealContent.Visibility = Visibility.Collapsed;
ViewboxBtnColorOrangeContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorBlackContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorBlueContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorGreenContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorRedContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorYellowContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorWhiteContent.Visibility = Visibility.Collapsed;
BoardViewboxBtnColorPinkContent.Visibility = Visibility.Collapsed;
switch (inkColor) {
case 0:
ViewboxBtnColorBlackContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorBlackContent.Visibility = Visibility.Visible;
break;
case 1:
ViewboxBtnColorRedContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorRedContent.Visibility = Visibility.Visible;
break;
case 2:
ViewboxBtnColorGreenContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorGreenContent.Visibility = Visibility.Visible;
break;
case 3:
ViewboxBtnColorBlueContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorBlueContent.Visibility = Visibility.Visible;
break;
case 4:
ViewboxBtnColorYellowContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorYellowContent.Visibility = Visibility.Visible;
break;
case 5:
ViewboxBtnColorWhiteContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorWhiteContent.Visibility = Visibility.Visible;
break;
case 6:
ViewboxBtnColorPinkContent.Visibility = Visibility.Visible;
BoardViewboxBtnColorPinkContent.Visibility = Visibility.Visible;
break;
case 7:
ViewboxBtnColorTealContent.Visibility = Visibility.Visible;
break;
case 8:
ViewboxBtnColorOrangeContent.Visibility = Visibility.Visible;
break;
}
}
private void BtnColorBlack_Click(object sender, RoutedEventArgs e) {
if (currentMode == 0) {
lastDesktopInkColor = 0;
} else {
lastBoardInkColor = 0;
}
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorRed_Click(object sender, RoutedEventArgs e) {
if (currentMode == 0) {
lastDesktopInkColor = 1;
} else {
lastBoardInkColor = 1;
}
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorGreen_Click(object sender, RoutedEventArgs e) {
if (currentMode == 0) {
lastDesktopInkColor = 2;
} else {
lastBoardInkColor = 2;
}
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorBlue_Click(object sender, RoutedEventArgs e) {
if (currentMode == 0) {
lastDesktopInkColor = 3;
} else {
lastBoardInkColor = 3;
}
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorYellow_Click(object sender, RoutedEventArgs e) {
if (currentMode == 0) {
lastDesktopInkColor = 4;
} else {
lastBoardInkColor = 4;
}
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorWhite_Click(object sender, RoutedEventArgs e) {
if (currentMode == 0) {
lastDesktopInkColor = 5;
} else {
lastBoardInkColor = 5;
}
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorPink_Click(object sender, RoutedEventArgs e) {
if (currentMode == 0) {
lastDesktopInkColor = 6;
} else {
lastBoardInkColor = 6;
}
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorOrange_Click(object sender, RoutedEventArgs e)
{
if (currentMode == 0)
{
lastDesktopInkColor = 8;
}
else
{
lastBoardInkColor = 8;
}
forceEraser = false;
ColorSwitchCheck();
}
private void BtnColorTeal_Click(object sender, RoutedEventArgs e)
{
if (currentMode == 0)
{
lastDesktopInkColor = 7;
}
else
{
lastBoardInkColor = 7;
}
forceEraser = false;
ColorSwitchCheck();
}
private Color StringToColor(string colorStr) {
Byte[] argb = new Byte[4];
for (int i = 0; i < 4; i++) {
char[] charArray = colorStr.Substring(i * 2 + 1, 2).ToCharArray();
Byte b1 = toByte(charArray[0]);
Byte b2 = toByte(charArray[1]);
argb[i] = (Byte)(b2 | (b1 << 4));
}
return Color.FromArgb(argb[0], argb[1], argb[2], argb[3]);//#FFFFFFFF
}
private static byte toByte(char c) {
byte b = (byte)"0123456789ABCDEF".IndexOf(c);
return b;
}
#endregion
}
}

View File

@ -198,6 +198,58 @@ namespace Ink_Canvas {
{
if (!isLoaded) return;
Settings.Canvas.EraserSize = ComboBoxEraserSizeFloatingBar.SelectedIndex;
ComboBoxEraserSize.SelectedIndex = ComboBoxEraserSizeFloatingBar.SelectedIndex;
if (Settings.Canvas.EraserShapeType == 0)
{
double k = 1;
switch (ComboBoxEraserSizeFloatingBar.SelectedIndex)
{
case 0:
k = 0.5;
break;
case 1:
k = 0.8;
break;
case 3:
k = 1.25;
break;
case 4:
k = 1.8;
break;
}
inkCanvas.EraserShape = new EllipseStylusShape(k * 90, k * 90);
}
else if (Settings.Canvas.EraserShapeType == 1)
{
double k = 1;
switch (ComboBoxEraserSizeFloatingBar.SelectedIndex)
{
case 0:
k = 0.7;
break;
case 1:
k = 0.9;
break;
case 3:
k = 1.2;
break;
case 4:
k = 1.6;
break;
}
inkCanvas.EraserShape = new RectangleStylusShape(k * 90 * 0.6, k * 90);
}
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
SaveSettingsToFile();
}
private void SwitchToCircleEraser(object sender, MouseButtonEventArgs e)
{
if (!isLoaded) return;
Settings.Canvas.EraserShapeType = 0;
SaveSettingsToFile();
CheckEraserTypeTab();
double k = 1;
switch (ComboBoxEraserSizeFloatingBar.SelectedIndex)
{
@ -215,10 +267,35 @@ namespace Ink_Canvas {
break;
}
inkCanvas.EraserShape = new EllipseStylusShape(k * 90, k * 90);
// inkCanvas.EraserShape = new RectangleStylusShape(k * 90, k * 90);
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
}
private void SwitchToRectangleEraser(object sender, MouseButtonEventArgs e)
{
if (!isLoaded) return;
Settings.Canvas.EraserShapeType = 1;
SaveSettingsToFile();
CheckEraserTypeTab();
double k = 1;
switch (ComboBoxEraserSizeFloatingBar.SelectedIndex)
{
case 0:
k = 0.7;
break;
case 1:
k = 0.9;
break;
case 3:
k = 1.2;
break;
case 4:
k = 1.6;
break;
}
inkCanvas.EraserShape = new RectangleStylusShape(k * 90 * 0.6, k * 90);
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
}
@ -232,6 +309,17 @@ namespace Ink_Canvas {
SaveSettingsToFile();
}
private void HighlighterWidthSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!isLoaded) return;
// if (sender == BoardInkWidthSlider) InkWidthSlider.Value = ((Slider)sender).Value;
// if (sender == InkWidthSlider) BoardInkWidthSlider.Value = ((Slider)sender).Value;
drawingAttributes.Height = ((Slider)sender).Value;
drawingAttributes.Width = ((Slider)sender).Value / 2;
Settings.Canvas.HighlighterWidth = ((Slider)sender).Value;
SaveSettingsToFile();
}
private void InkAlphaSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!isLoaded) return;
@ -397,6 +485,13 @@ namespace Ink_Canvas {
SaveSettingsToFile();
}
private void ToggleSwitchClearCanvasAndClearTimeMachine_Toggled(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
Settings.Canvas.ClearCanvasAndClearTimeMachine = ToggleSwitchClearCanvasAndClearTimeMachine.IsOn;
SaveSettingsToFile();
}
private void ToggleSwitchFitToCurve_Toggled(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
@ -642,9 +737,12 @@ namespace Ink_Canvas {
Settings.Canvas.InkWidth = 2.5;
Settings.Canvas.IsShowCursor = false;
Settings.Canvas.InkStyle = 0;
Settings.Canvas.HighlighterWidth = 20;
Settings.Canvas.EraserSize = 1;
Settings.Canvas.EraserType = 0;
Settings.Canvas.EraserShapeType = 1;
Settings.Canvas.HideStrokeWhenSelecting = false;
Settings.Canvas.ClearCanvasAndClearTimeMachine = false;
Settings.Canvas.FitToCurve = true;
Settings.Canvas.UsingWhiteboard = false;
Settings.Canvas.HyperbolaAsymptoteOption = 0;

View File

@ -3,6 +3,8 @@ using Newtonsoft.Json;
using System;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Ink;
using System.Windows.Media;
using File = System.IO.File;
@ -55,7 +57,7 @@ namespace Ink_Canvas {
ToggleSwitchIsAutoUpdate.IsOn = true;
AutoUpdate();
}
ToggleSwitchIsAutoUpdateWithSilence.Visibility = Settings.Startup.IsAutoUpdate ? Visibility.Visible : Visibility.Collapsed;
// ToggleSwitchIsAutoUpdateWithSilence.Visibility = Settings.Startup.IsAutoUpdate ? Visibility.Visible : Visibility.Collapsed;
if (Settings.Startup.IsAutoUpdateWithSilence) {
ToggleSwitchIsAutoUpdateWithSilence.IsOn = true;
}
@ -290,6 +292,7 @@ namespace Ink_Canvas {
drawingAttributes.Width = Settings.Canvas.InkWidth;
InkWidthSlider.Value = Settings.Canvas.InkWidth * 2;
HighlighterWidthSlider.Value = Settings.Canvas.HighlighterWidth;
ComboBoxHyperbolaAsymptoteOption.SelectedIndex = (int)Settings.Canvas.HyperbolaAsymptoteOption;
@ -313,6 +316,58 @@ namespace Ink_Canvas {
ComboBoxEraserSize.SelectedIndex = Settings.Canvas.EraserSize;
ComboBoxEraserSizeFloatingBar.SelectedIndex = Settings.Canvas.EraserSize;
if (Settings.Canvas.ClearCanvasAndClearTimeMachine==true) {
ToggleSwitchClearCanvasAndClearTimeMachine.IsOn = true;
} else
{
ToggleSwitchClearCanvasAndClearTimeMachine.IsOn = false;
}
if (Settings.Canvas.EraserShapeType==0)
{
double k = 1;
switch (Settings.Canvas.EraserSize)
{
case 0:
k = 0.5;
break;
case 1:
k = 0.8;
break;
case 3:
k = 1.25;
break;
case 4:
k = 1.8;
break;
}
inkCanvas.EraserShape = new EllipseStylusShape(k * 90, k * 90);
inkCanvas.EditingMode = InkCanvasEditingMode.None;
} else if (Settings.Canvas.EraserShapeType == 1)
{
double k = 1;
switch (Settings.Canvas.EraserSize)
{
case 0:
k = 0.7;
break;
case 1:
k = 0.9;
break;
case 3:
k = 1.2;
break;
case 4:
k = 1.6;
break;
}
inkCanvas.EraserShape = new RectangleStylusShape(k * 90 * 0.6, k * 90);
inkCanvas.EditingMode = InkCanvasEditingMode.None;
}
CheckEraserTypeTab();
if (Settings.Canvas.HideStrokeWhenSelecting) {
ToggleSwitchHideStrokeWhenSelecting.IsOn = true;
} else {

View File

@ -311,68 +311,75 @@ namespace Ink_Canvas {
switch (Settings.Canvas.InkStyle) {
case 1:
try {
StylusPointCollection stylusPoints = new StylusPointCollection();
int n = e.Stroke.StylusPoints.Count - 1;
string s = "";
if (penType == 0)
{
try {
StylusPointCollection stylusPoints = new StylusPointCollection();
int n = e.Stroke.StylusPoints.Count - 1;
string s = "";
for (int i = 0; i <= n; i++) {
double speed = GetPointSpeed(e.Stroke.StylusPoints[Math.Max(i - 1, 0)].ToPoint(), e.Stroke.StylusPoints[i].ToPoint(), e.Stroke.StylusPoints[Math.Min(i + 1, n)].ToPoint());
s += speed.ToString() + "\t";
StylusPoint point = new StylusPoint();
if (speed >= 0.25) {
point.PressureFactor = (float)(0.5 - 0.3 * (Math.Min(speed, 1.5) - 0.3) / 1.2);
} else if (speed >= 0.05) {
point.PressureFactor = (float)0.5;
} else {
point.PressureFactor = (float)(0.5 + 0.4 * (0.05 - speed) / 0.05);
for (int i = 0; i <= n; i++) {
double speed = GetPointSpeed(e.Stroke.StylusPoints[Math.Max(i - 1, 0)].ToPoint(), e.Stroke.StylusPoints[i].ToPoint(), e.Stroke.StylusPoints[Math.Min(i + 1, n)].ToPoint());
s += speed.ToString() + "\t";
StylusPoint point = new StylusPoint();
if (speed >= 0.25) {
point.PressureFactor = (float)(0.5 - 0.3 * (Math.Min(speed, 1.5) - 0.3) / 1.2);
} else if (speed >= 0.05) {
point.PressureFactor = (float)0.5;
} else {
point.PressureFactor = (float)(0.5 + 0.4 * (0.05 - speed) / 0.05);
}
point.X = e.Stroke.StylusPoints[i].X;
point.Y = e.Stroke.StylusPoints[i].Y;
stylusPoints.Add(point);
}
point.X = e.Stroke.StylusPoints[i].X;
point.Y = e.Stroke.StylusPoints[i].Y;
stylusPoints.Add(point);
}
e.Stroke.StylusPoints = stylusPoints;
} catch {
e.Stroke.StylusPoints = stylusPoints;
} catch {
}
}
break;
case 0:
try {
StylusPointCollection stylusPoints = new StylusPointCollection();
int n = e.Stroke.StylusPoints.Count - 1;
double pressure = 0.1;
int x = 10;
if (n == 1) return;
if (n >= x) {
for (int i = 0; i < n - x; i++) {
StylusPoint point = new StylusPoint();
if (penType==0)
{
try {
StylusPointCollection stylusPoints = new StylusPointCollection();
int n = e.Stroke.StylusPoints.Count - 1;
double pressure = 0.1;
int x = 10;
if (n == 1) return;
if (n >= x) {
for (int i = 0; i < n - x; i++) {
StylusPoint point = new StylusPoint();
point.PressureFactor = (float)0.5;
point.X = e.Stroke.StylusPoints[i].X;
point.Y = e.Stroke.StylusPoints[i].Y;
stylusPoints.Add(point);
}
for (int i = n - x; i <= n; i++) {
StylusPoint point = new StylusPoint();
point.PressureFactor = (float)0.5;
point.X = e.Stroke.StylusPoints[i].X;
point.Y = e.Stroke.StylusPoints[i].Y;
stylusPoints.Add(point);
}
for (int i = n - x; i <= n; i++) {
StylusPoint point = new StylusPoint();
point.PressureFactor = (float)((0.5 - pressure) * (n - i) / x + pressure);
point.X = e.Stroke.StylusPoints[i].X;
point.Y = e.Stroke.StylusPoints[i].Y;
stylusPoints.Add(point);
}
} else {
for (int i = 0; i <= n; i++) {
StylusPoint point = new StylusPoint();
point.PressureFactor = (float)((0.5 - pressure) * (n - i) / x + pressure);
point.X = e.Stroke.StylusPoints[i].X;
point.Y = e.Stroke.StylusPoints[i].Y;
stylusPoints.Add(point);
}
} else {
for (int i = 0; i <= n; i++) {
StylusPoint point = new StylusPoint();
point.PressureFactor = (float)(0.4 * (n - i) / n + pressure);
point.X = e.Stroke.StylusPoints[i].X;
point.Y = e.Stroke.StylusPoints[i].Y;
stylusPoints.Add(point);
point.PressureFactor = (float)(0.4 * (n - i) / n + pressure);
point.X = e.Stroke.StylusPoints[i].X;
point.Y = e.Stroke.StylusPoints[i].Y;
stylusPoints.Add(point);
}
}
e.Stroke.StylusPoints = stylusPoints;
} catch {
}
e.Stroke.StylusPoints = stylusPoints;
} catch {
}
break;
case 3: //根据 mode == 0 改写,目前暂未完成
@ -472,7 +479,7 @@ namespace Ink_Canvas {
}
public StylusPointCollection GenerateFakePressureTriangle(StylusPointCollection points) {
if (Settings.InkToShape.IsInkToShapeNoFakePressureTriangle == true)
if (Settings.InkToShape.IsInkToShapeNoFakePressureTriangle == true || penType==1)
{
var newPoint = new StylusPointCollection();
newPoint.Add(new StylusPoint(points[0].X, points[0].Y));
@ -508,7 +515,7 @@ namespace Ink_Canvas {
}
public StylusPointCollection GenerateFakePressureRectangle(StylusPointCollection points) {
if (Settings.InkToShape.IsInkToShapeNoFakePressureRectangle == true) {
if (Settings.InkToShape.IsInkToShapeNoFakePressureRectangle == true || penType == 1) {
return points;
} else
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

View File

@ -28,6 +28,8 @@ namespace Ink_Canvas
{
[JsonProperty("inkWidth")]
public double InkWidth { get; set; } = 2.5;
[JsonProperty("highlighterWidth")]
public double HighlighterWidth { get; set; } = 20;
[JsonProperty("inkAlpha")]
public double InkAlpha { get; set; } = 255;
[JsonProperty("isShowCursor")]
@ -38,10 +40,14 @@ namespace Ink_Canvas
public int EraserSize { get; set; } = 2;
[JsonProperty("eraserType")]
public int EraserType { get; set; } = 0; // 0 - 图标切换模式 1 - 面积擦 2 - 线条擦
[JsonProperty("eraserShapeType")]
public int EraserShapeType { get; set; } = 0; // 0 - 圆形擦 1 - 黑板擦
[JsonProperty("hideStrokeWhenSelecting")]
public bool HideStrokeWhenSelecting { get; set; } = true;
[JsonProperty("fitToCurve")]
public bool FitToCurve { get; set; } = true;
[JsonProperty("clearCanvasAndClearTimeMachine")]
public bool ClearCanvasAndClearTimeMachine { get; set; } = false;
[JsonProperty("usingWhiteboard")]
public bool UsingWhiteboard { get; set; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 944 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B