Merge branch 'master' of https://github.com/WXRIW/Ink-Canvas into feat/TimeMachine
# Conflicts: # Ink Canvas/MainWindow.xaml.cs
This commit is contained in:
commit
99fd5497f6
26
.github/workflows/main.yml
vendored
26
.github/workflows/main.yml
vendored
@ -45,9 +45,35 @@ jobs:
|
||||
env:
|
||||
Configuration: ${{ matrix.configuration }}
|
||||
|
||||
- name: Build the solution (x64)
|
||||
run: |
|
||||
msbuild -t:restore /p:GitFlow="Github Action"
|
||||
msbuild /p:Configuration=Release /p:Platform="x64" /p:GitFlow="Github Action"
|
||||
env:
|
||||
Configuration: ${{ matrix.configuration }}
|
||||
|
||||
- name: Build the solution (ARM64)
|
||||
run: |
|
||||
msbuild -t:restore /p:GitFlow="Github Action"
|
||||
msbuild /p:Configuration=Release /p:Platform="ARM64" /p:GitFlow="Github Action"
|
||||
env:
|
||||
Configuration: ${{ matrix.configuration }}
|
||||
|
||||
# 上传编译成品
|
||||
- name: Upload to artifact
|
||||
uses: actions/upload-artifact@main
|
||||
with:
|
||||
name: Ink-Canvas
|
||||
path: Ink Canvas/bin/Release
|
||||
|
||||
- name: Upload to artifact (x64)
|
||||
uses: actions/upload-artifact@main
|
||||
with:
|
||||
name: Ink-Canvas-x64
|
||||
path: Ink Canvas/bin/x64/Release
|
||||
|
||||
- name: Upload to artifact (ARM64)
|
||||
uses: actions/upload-artifact@main
|
||||
with:
|
||||
name: Ink-Canvas-ARM64
|
||||
path: Ink Canvas/bin/ARM64/Release
|
||||
|
@ -1,20 +1,32 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29806.167
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.33530.505
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ink Canvas", "Ink Canvas\Ink Canvas.csproj", "{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM64 = Debug|ARM64
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM64 = Release|ARM64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Debug|x64.Build.0 = Debug|x64
|
||||
{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Release|x64.ActiveCfg = Release|x64
|
||||
{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -79,6 +79,46 @@
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
|
||||
<OutputPath>bin\ARM64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="IACore">
|
||||
<HintPath>.\IACore.dll</HintPath>
|
||||
@ -91,10 +131,6 @@
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="netstandard" />
|
||||
<Reference Include="OAUS.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>AutoUpdater\OAUS.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
|
@ -20,7 +20,7 @@
|
||||
Closing="Window_Closing"
|
||||
Closed="Window_Closed"
|
||||
PreviewKeyDown="Main_Grid_PreviewKeyDown"
|
||||
Height="1000" Width="1000"
|
||||
Height="10000" Width="1000"
|
||||
FontFamily="Microsoft YaHei UI"
|
||||
MouseWheel="Window_MouseWheel"
|
||||
Foreground="Black"
|
||||
@ -433,7 +433,7 @@
|
||||
<ui:ToggleSwitch Name="ToggleSwitchEnableTwoFingerRotationOnSelection" Header="允许双指旋转选中的墨迹" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchEnableTwoFingerRotation_Toggled"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Header="墨迹识别 (Beta)">
|
||||
<GroupBox Name="GroupBoxInkRecognition" Header="墨迹识别 (Beta)">
|
||||
<ui:SimpleStackPanel Spacing="12">
|
||||
<TextBlock Text="墨迹识别功能目前处于开发阶段,目前可实现智能识别圆、三角形、
矩形,并自动转换为规范图形。" Foreground="#666666"/>
|
||||
<ui:ToggleSwitch Name="ToggleSwitchEnableInkToShape" Header="启用墨迹识别" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchEnableInkToShape_Toggled" IsOn="True"/>
|
||||
|
@ -530,6 +530,10 @@ namespace Ink_Canvas
|
||||
|
||||
//加载设置
|
||||
LoadSettings();
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
GroupBoxInkRecognition.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light;
|
||||
|
||||
@ -5606,7 +5610,9 @@ namespace Ink_Canvas
|
||||
try
|
||||
{
|
||||
inkCanvas.Opacity = 1;
|
||||
if (Settings.InkToShape.IsInkToShapeEnabled)
|
||||
if (Settings.InkToShape.IsInkToShapeEnabled && !Environment.Is64BitProcess)
|
||||
{
|
||||
void InkToShapeProcess()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -5631,8 +5637,26 @@ namespace Ink_Canvas
|
||||
result = newResult;
|
||||
break;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
Point iniP = new Point(result.Centroid.X - shape.Width / 2, result.Centroid.Y - shape.Height / 2);
|
||||
Point endP = new Point(result.Centroid.X + shape.Width / 2, result.Centroid.Y + shape.Height / 2);
|
||||
var pointList = GenerateEllipseGeometry(iniP, endP);
|
||||
var point = new StylusPointCollection(pointList);
|
||||
var stroke = new Stroke(point)
|
||||
{
|
||||
DrawingAttributes = inkCanvas.DefaultDrawingAttributes.Clone()
|
||||
};
|
||||
circles.Add(new Circle(result.Centroid, shape.Width / 2.0, stroke));
|
||||
SetNewBackupOfStroke();
|
||||
IsEraseByShapeRecognition = true;
|
||||
inkCanvas.Strokes.Remove(result.InkDrawingNode.Strokes);
|
||||
inkCanvas.Strokes.Add(stroke);
|
||||
newStrokes = new StrokeCollection();
|
||||
=======
|
||||
//Label.Visibility = Visibility.Visible;
|
||||
Label.Content = circles.Count.ToString() + "\n" + newResult.InkDrawingNode.GetShapeName();
|
||||
>>>>>>> ab83992ef82c63ba7a9d4ef428f11edc45718bb3
|
||||
}
|
||||
if (result.InkDrawingNode.GetShapeName() == "Circle")
|
||||
{
|
||||
@ -5686,9 +5710,8 @@ namespace Ink_Canvas
|
||||
};
|
||||
circles.Add(new Circle(result.Centroid, shape.Width / 2.0, stroke));
|
||||
SetNewBackupOfStroke();
|
||||
IsEraseByShapeRecognition = true;
|
||||
inkCanvas.Strokes.Remove(result.InkDrawingNode.Strokes);
|
||||
inkCanvas.Strokes.Add(stroke);
|
||||
inkCanvas.Strokes.Remove(result.InkDrawingNode.Strokes);
|
||||
newStrokes = new StrokeCollection();
|
||||
}
|
||||
}
|
||||
@ -5726,38 +5749,7 @@ namespace Ink_Canvas
|
||||
iniP = new Point(result.Centroid.X - shape.Width / 2, result.Centroid.Y - shape.Height / 2);
|
||||
endP = new Point(result.Centroid.X + shape.Width / 2, result.Centroid.Y + shape.Height / 2);
|
||||
|
||||
//再判断是否与圆相切
|
||||
if (Math.Abs(a - circle.R) / a < 0.2)
|
||||
{
|
||||
if (shape.Width >= shape.Height)
|
||||
{
|
||||
iniP.X = result.Centroid.X - circle.R;
|
||||
endP.X = result.Centroid.X + circle.R;
|
||||
iniP.Y = result.Centroid.Y - b;
|
||||
endP.Y = result.Centroid.Y + b;
|
||||
}
|
||||
else
|
||||
{
|
||||
iniP.Y = result.Centroid.Y - circle.R;
|
||||
endP.Y = result.Centroid.Y + circle.R;
|
||||
iniP.X = result.Centroid.X - a;
|
||||
endP.X = result.Centroid.X + a;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (Math.Abs(result.Centroid.X - circle.Centroid.X) / a < 0.2)
|
||||
{
|
||||
double sinTheta = Math.Abs(circle.Centroid.Y - result.Centroid.Y) / circle.R;
|
||||
double cosTheta = Math.Sqrt(1 - sinTheta * sinTheta);
|
||||
double newA = circle.R * cosTheta;
|
||||
if (circle.R * sinTheta / circle.R < 0.9 && a / b > 2 && Math.Abs(newA - a) / newA < 0.3)
|
||||
{
|
||||
iniP.X = circle.Centroid.X - newA;
|
||||
endP.X = circle.Centroid.X + newA;
|
||||
iniP.Y = result.Centroid.Y - newA / 5;
|
||||
endP.Y = result.Centroid.Y + newA / 5;
|
||||
|
||||
<<<<<<< HEAD
|
||||
double topB = endP.Y - iniP.Y;
|
||||
|
||||
SetNewBackupOfStroke();
|
||||
@ -5782,6 +5774,55 @@ namespace Ink_Canvas
|
||||
inkCanvas.Strokes.Add(_stroke.Clone());
|
||||
inkCanvas.Strokes.Add(_generateDashedLineEllipseStrokeCollection);
|
||||
return;
|
||||
=======
|
||||
//再判断是否与圆相切
|
||||
if (Math.Abs(a - circle.R) / a < 0.2)
|
||||
{
|
||||
if (shape.Width >= shape.Height)
|
||||
{
|
||||
iniP.X = result.Centroid.X - circle.R;
|
||||
endP.X = result.Centroid.X + circle.R;
|
||||
iniP.Y = result.Centroid.Y - b;
|
||||
endP.Y = result.Centroid.Y + b;
|
||||
}
|
||||
else
|
||||
{
|
||||
iniP.Y = result.Centroid.Y - circle.R;
|
||||
endP.Y = result.Centroid.Y + circle.R;
|
||||
iniP.X = result.Centroid.X - a;
|
||||
endP.X = result.Centroid.X + a;
|
||||
}
|
||||
}
|
||||
break;
|
||||
>>>>>>> ab83992ef82c63ba7a9d4ef428f11edc45718bb3
|
||||
}
|
||||
else if (Math.Abs(result.Centroid.X - circle.Centroid.X) / a < 0.2)
|
||||
{
|
||||
double sinTheta = Math.Abs(circle.Centroid.Y - result.Centroid.Y) / circle.R;
|
||||
double cosTheta = Math.Sqrt(1 - sinTheta * sinTheta);
|
||||
double newA = circle.R * cosTheta;
|
||||
if (circle.R * sinTheta / circle.R < 0.9 && a / b > 2 && Math.Abs(newA - a) / newA < 0.3)
|
||||
{
|
||||
iniP.X = circle.Centroid.X - newA;
|
||||
endP.X = circle.Centroid.X + newA;
|
||||
iniP.Y = result.Centroid.Y - newA / 5;
|
||||
endP.Y = result.Centroid.Y + newA / 5;
|
||||
|
||||
double topB = endP.Y - iniP.Y;
|
||||
|
||||
SetNewBackupOfStroke();
|
||||
inkCanvas.Strokes.Remove(result.InkDrawingNode.Strokes);
|
||||
newStrokes = new StrokeCollection();
|
||||
|
||||
var _pointList = GenerateEllipseGeometry(iniP, endP, false, true);
|
||||
var _point = new StylusPointCollection(_pointList);
|
||||
var _stroke = new Stroke(_point)
|
||||
{
|
||||
DrawingAttributes = inkCanvas.DefaultDrawingAttributes.Clone()
|
||||
};
|
||||
inkCanvas.Strokes.Add(_stroke.Clone());
|
||||
inkCanvas.Strokes.Add(GenerateDashedLineEllipseStrokeCollection(iniP, endP, true, false));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (Math.Abs(result.Centroid.Y - circle.Centroid.Y) / a < 0.2)
|
||||
@ -5826,9 +5867,8 @@ namespace Ink_Canvas
|
||||
}
|
||||
|
||||
SetNewBackupOfStroke();
|
||||
IsEraseByShapeRecognition = true;
|
||||
inkCanvas.Strokes.Remove(result.InkDrawingNode.Strokes);
|
||||
inkCanvas.Strokes.Add(stroke);
|
||||
inkCanvas.Strokes.Remove(result.InkDrawingNode.Strokes);
|
||||
newStrokes = new StrokeCollection();
|
||||
}
|
||||
}
|
||||
@ -5858,6 +5898,34 @@ namespace Ink_Canvas
|
||||
DrawingAttributes = inkCanvas.DefaultDrawingAttributes.Clone()
|
||||
};
|
||||
SetNewBackupOfStroke();
|
||||
inkCanvas.Strokes.Add(stroke);
|
||||
inkCanvas.Strokes.Remove(result.InkDrawingNode.Strokes);
|
||||
newStrokes = new StrokeCollection();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
SetNewBackupOfStroke();
|
||||
IsEraseByShapeRecognition = true;
|
||||
inkCanvas.Strokes.Remove(result.InkDrawingNode.Strokes);
|
||||
inkCanvas.Strokes.Add(stroke);
|
||||
newStrokes = new StrokeCollection();
|
||||
=======
|
||||
>>>>>>> ab83992ef82c63ba7a9d4ef428f11edc45718bb3
|
||||
}
|
||||
else if (result.InkDrawingNode.GetShapeName().Contains("Rectangle") ||
|
||||
result.InkDrawingNode.GetShapeName().Contains("Diamond") ||
|
||||
result.InkDrawingNode.GetShapeName().Contains("Parallelogram") ||
|
||||
result.InkDrawingNode.GetShapeName().Contains("Square"))
|
||||
{
|
||||
var shape = result.InkDrawingNode.GetShape();
|
||||
var p = result.InkDrawingNode.HotPoints;
|
||||
if ((Math.Max(Math.Max(Math.Max(p[0].X, p[1].X), p[2].X), p[3].X) - Math.Min(Math.Min(Math.Min(p[0].X, p[1].X), p[2].X), p[3].X) >= 100 ||
|
||||
Math.Max(Math.Max(Math.Max(p[0].Y, p[1].Y), p[2].Y), p[3].Y) - Math.Min(Math.Min(Math.Min(p[0].Y, p[1].Y), p[2].Y), p[3].Y) >= 100) && result.InkDrawingNode.HotPoints.Count == 4)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
DrawingAttributes = inkCanvas.DefaultDrawingAttributes.Clone()
|
||||
};
|
||||
SetNewBackupOfStroke();
|
||||
IsEraseByShapeRecognition = true;
|
||||
inkCanvas.Strokes.Remove(result.InkDrawingNode.Strokes);
|
||||
inkCanvas.Strokes.Add(stroke);
|
||||
@ -5900,14 +5968,47 @@ namespace Ink_Canvas
|
||||
inkCanvas.Strokes.Remove(result.InkDrawingNode.Strokes);
|
||||
inkCanvas.Strokes.Add(stroke);
|
||||
newStrokes = new StrokeCollection();
|
||||
=======
|
||||
//纠正垂直与水平关系
|
||||
var newPoints = FixPointsDirection(p[0], p[1]);
|
||||
p[0] = newPoints[0];
|
||||
p[1] = newPoints[1];
|
||||
newPoints = FixPointsDirection(p[1], p[2]);
|
||||
p[1] = newPoints[0];
|
||||
p[2] = newPoints[1];
|
||||
newPoints = FixPointsDirection(p[2], p[3]);
|
||||
p[2] = newPoints[0];
|
||||
p[3] = newPoints[1];
|
||||
newPoints = FixPointsDirection(p[3], p[0]);
|
||||
p[3] = newPoints[0];
|
||||
p[0] = newPoints[1];
|
||||
|
||||
var pointList = p.ToList();
|
||||
pointList.Add(p[0]);
|
||||
var point = new StylusPointCollection(pointList);
|
||||
var stroke = new Stroke(GenerateFakePressureRectangle(point))
|
||||
{
|
||||
DrawingAttributes = inkCanvas.DefaultDrawingAttributes.Clone()
|
||||
};
|
||||
SetNewBackupOfStroke();
|
||||
inkCanvas.Strokes.Add(stroke);
|
||||
inkCanvas.Strokes.Remove(result.InkDrawingNode.Strokes);
|
||||
newStrokes = new StrokeCollection();
|
||||
}
|
||||
>>>>>>> ab83992ef82c63ba7a9d4ef428f11edc45718bb3
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
catch { }
|
||||
finally
|
||||
{
|
||||
IsEraseByShapeRecognition = false;
|
||||
}
|
||||
=======
|
||||
InkToShapeProcess();
|
||||
>>>>>>> ab83992ef82c63ba7a9d4ef428f11edc45718bb3
|
||||
}
|
||||
|
||||
// 检查是否是压感笔书写
|
||||
|
Loading…
Reference in New Issue
Block a user