mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 22:34:27 -07:00
Fixed an issue when building on Win7, where the Win10 project was copied. Integrated some experimental code, which should replace some other code soon to improve the startup time. Fixed a lot of small issues, and made the tests work again. Removed an old Span<T> experiment. [skip ci]
This commit is contained in:
parent
e91bf3f2d0
commit
77162087c6
45 changed files with 123 additions and 697 deletions
|
@ -49,7 +49,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="!$(MSBuildProjectName.Contains('Tests')) And $(MSBuildProjectName.StartsWith('Greenshot'))">
|
||||
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.125">
|
||||
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.136">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
@ -59,7 +59,7 @@
|
|||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" BeforeTargets="PostBuildEvent" Condition="$(MSBuildProjectName.Contains('Addon.')) And !$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Demo'))">
|
||||
<Target Name="PostBuild" BeforeTargets="PostBuildEvent" Condition="$(MSBuildProjectName.Contains('Addon.')) And !$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Demo')) And ($(OsProductName.Contains('Windows 10')) Or (!$(OsProductName.Contains('Windows 10')) And !$(MSBuildProjectName.Contains('Win10'))))">
|
||||
<Exec Command="
|
||||
xcopy /q /y /d "$(TargetDir)$(TargetName).*" "$(SolutionDir)$(SolutionName)\$(OutDir)"

|
||||
xcopy /q /y /d "$(TargetDir)*.dll" "$(SolutionDir)$(SolutionName)\$(OutDir)"

|
||||
|
|
|
@ -43,13 +43,13 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.JsonNet" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
|
|
@ -50,12 +50,12 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.JsonNet" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="Dapplo.Confluence" Version="0.8.16" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
|
|
@ -45,13 +45,13 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.JsonNet" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="CliWrap" Version="2.2.0" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
|
|
@ -45,11 +45,11 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
|
|
@ -45,11 +45,11 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
|
|
@ -45,12 +45,12 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.JsonNet" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
|
|
@ -30,10 +30,10 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapplo.Windows">
|
||||
<Version>0.8.9</Version>
|
||||
<Version>0.8.17</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Dapplo.Windows.Com">
|
||||
<Version>0.8.9</Version>
|
||||
<Version>0.8.17</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Unofficial.Microsoft.mshtml" Version="7.0.3300" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -47,13 +47,13 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.JsonNet" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Utils" Version="1.1.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="Dapplo.Jira" Version="0.8.9" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
|
|
@ -131,13 +131,13 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="CommonServiceLocator" Version="2.0.4" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Icons" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="Dapplo.Windows.Icons" Version="0.8.17" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
|
|
@ -45,12 +45,12 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.JsonNet" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="MahApps.Metro" Version="2.0.0-alpha0212" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="Interop.Microsoft.Office.Interop.OneNote" Version="1.1.0" />
|
||||
<PackageReference Include="Microsoft.Office.Interop.Excel" Version="15.0.4795.1000" />
|
||||
<PackageReference Include="Microsoft.Office.Interop.Outlook" Version="15.0.4797.1003" />
|
||||
|
|
|
@ -45,12 +45,12 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.JsonNet" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="MahApps.Metro" Version="2.0.0-alpha0212" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
|
|
@ -45,11 +45,11 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
|
|
@ -45,12 +45,12 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.JsonNet" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="MahApps.Metro" Version="2.0.0-alpha0212" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.Win10</RootNamespace>
|
||||
|
@ -55,7 +55,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="System.Runtime.WindowsRuntime" Version="4.6.0-preview.19073.11" />
|
||||
<PackageReference Include="Microsoft.Toolkit.Forms.UI.Controls" Version="6.0.0-preview1" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Configuration">
|
||||
<Version>1.2.21</Version>
|
||||
</PackageReference>
|
||||
|
@ -62,10 +62,10 @@
|
|||
<Version>0.9.18</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard">
|
||||
<Version>0.8.9</Version>
|
||||
<Version>0.8.17</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Dapplo.Windows.Icons">
|
||||
<Version>0.8.9</Version>
|
||||
<Version>0.8.17</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
@ -75,7 +75,7 @@
|
|||
<Version>3.0.0-alpha0103</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Svg">
|
||||
<Version>2.4.1</Version>
|
||||
<Version>2.4.2</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapplo.Windows.Icons">
|
||||
<Version>0.8.9</Version>
|
||||
<Version>0.8.17</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -1,419 +0,0 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
|
||||
//
|
||||
// For more information see: http://getgreenshot.org/
|
||||
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Threading.Tasks;
|
||||
using Greenshot.Gfx.Experimental.Structs;
|
||||
|
||||
|
||||
namespace Greenshot.Gfx.Experimental
|
||||
{
|
||||
/// <summary>
|
||||
/// Code to apply a box blur
|
||||
/// </summary>
|
||||
public static class BoxBlurSpan
|
||||
{
|
||||
/// <summary>
|
||||
/// Apply BoxBlur to the destinationBitmap
|
||||
/// </summary>
|
||||
/// <param name="destinationBitmap">Bitmap to blur</param>
|
||||
/// <param name="range">Must be ODD, if not +1 is used</param>
|
||||
public static void ApplyBoxBlurSpan(this Bitmap destinationBitmap, int range)
|
||||
{
|
||||
var bitmapData = destinationBitmap.LockBits(new Rectangle(Point.Empty, destinationBitmap.Size), ImageLockMode.ReadWrite, destinationBitmap.PixelFormat);
|
||||
try
|
||||
{
|
||||
var pixelStride = destinationBitmap.Width;
|
||||
bool isAlpha = false;
|
||||
switch (bitmapData.PixelFormat)
|
||||
{
|
||||
case PixelFormat.Format24bppRgb:
|
||||
pixelStride = bitmapData.Stride / 3;
|
||||
break;
|
||||
case PixelFormat.Format32bppRgb:
|
||||
pixelStride = bitmapData.Stride / 4;
|
||||
break;
|
||||
case PixelFormat.Format32bppArgb:
|
||||
pixelStride = bitmapData.Stride / 4;
|
||||
isAlpha = true;
|
||||
break;
|
||||
}
|
||||
|
||||
var spanInfo = new SpanInfo
|
||||
{
|
||||
Width = destinationBitmap.Width,
|
||||
Height = destinationBitmap.Height,
|
||||
Left = 0,
|
||||
Right = destinationBitmap.Width,
|
||||
Top = 0,
|
||||
Bottom = destinationBitmap.Height,
|
||||
Pointer = bitmapData.Scan0,
|
||||
PixelStride = pixelStride,
|
||||
BitmapSize = destinationBitmap.Height * pixelStride
|
||||
};
|
||||
|
||||
if (isAlpha)
|
||||
{
|
||||
ApplyBoxBlurSpanAlpha(spanInfo, range);
|
||||
}
|
||||
else
|
||||
{
|
||||
ApplyBoxBlurSpan(spanInfo, range);
|
||||
}
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
destinationBitmap.UnlockBits(bitmapData);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply BoxBlur to the fastBitmap
|
||||
/// </summary>
|
||||
/// <param name="spanInfo">SpanInfo</param>
|
||||
/// <param name="range">Must be even!</param>
|
||||
private static void ApplyBoxBlurSpan(SpanInfo spanInfo, int range)
|
||||
{
|
||||
// Range must be odd!
|
||||
if ((range & 1) == 0)
|
||||
{
|
||||
range++;
|
||||
}
|
||||
if (range <= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Box blurs are frequently used to approximate a Gaussian blur.
|
||||
// By the central limit theorem, if applied 3 times on the same image, a box blur approximates the Gaussian kernel to within about 3%, yielding the same result as a quadratic convolution kernel.
|
||||
// This might be true, but the GDI+ BlurEffect doesn't look the same, a 2x blur is more simular and we only make 2x Box-Blur.
|
||||
// (Might also be a mistake in our blur, but for now it looks great)
|
||||
BoxBlurHorizontalSpan(spanInfo, range);
|
||||
BoxBlurVerticalSpan(spanInfo, range);
|
||||
BoxBlurHorizontalSpan(spanInfo, range);
|
||||
BoxBlurVerticalSpan(spanInfo, range);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Apply BoxBlur to the fastBitmap
|
||||
/// </summary>
|
||||
/// <param name="spanInfo">SpanInfo</param>
|
||||
/// <param name="range">Must be even!</param>
|
||||
private static void ApplyBoxBlurSpanAlpha(SpanInfo spanInfo, int range)
|
||||
{
|
||||
// Range must be odd!
|
||||
if ((range & 1) == 0)
|
||||
{
|
||||
range++;
|
||||
}
|
||||
if (range <= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Box blurs are frequently used to approximate a Gaussian blur.
|
||||
// By the central limit theorem, if applied 3 times on the same image, a box blur approximates the Gaussian kernel to within about 3%, yielding the same result as a quadratic convolution kernel.
|
||||
// This might be true, but the GDI+ BlurEffect doesn't look the same, a 2x blur is more simular and we only make 2x Box-Blur.
|
||||
// (Might also be a mistake in our blur, but for now it looks great)
|
||||
BoxBlurHorizontalSpanAlpha(spanInfo, range);
|
||||
BoxBlurVerticalSpanAlpha(spanInfo, range);
|
||||
BoxBlurHorizontalSpanAlpha(spanInfo, range);
|
||||
BoxBlurVerticalSpanAlpha(spanInfo, range);
|
||||
}
|
||||
/// <summary>
|
||||
/// BoxBlurHorizontal is a private helper method for the BoxBlur, only for IFastBitmaps with alpha channel
|
||||
/// </summary>
|
||||
/// <param name="spanInfo"></param>
|
||||
/// <param name="range">Range must be odd!</param>
|
||||
private static void BoxBlurHorizontalSpan(SpanInfo spanInfo, int range)
|
||||
{
|
||||
var halfRange = range / 2;
|
||||
|
||||
Parallel.For(spanInfo.Top, spanInfo.Bottom, y =>
|
||||
{
|
||||
unsafe {
|
||||
var rgb24 = new Span<Bgr32>((byte*)spanInfo.Pointer, spanInfo.BitmapSize);
|
||||
Span<Bgr32> averages = stackalloc Bgr32[range];
|
||||
var r = 0;
|
||||
var g = 0;
|
||||
var b = 0;
|
||||
var hits = halfRange;
|
||||
for (var x = spanInfo.Left; x < spanInfo.Left + halfRange; x++)
|
||||
{
|
||||
ref Bgr32 color = ref rgb24[x + (y * spanInfo.PixelStride)];
|
||||
|
||||
r += color.R;
|
||||
g += color.G;
|
||||
b += color.B;
|
||||
}
|
||||
for (var x = spanInfo.Left; x < spanInfo.Right; x++)
|
||||
{
|
||||
var leftSide = x - halfRange - 1;
|
||||
if (leftSide >= spanInfo.Left)
|
||||
{
|
||||
// Get value at the left side of range
|
||||
ref Bgr32 color = ref rgb24[leftSide + (y * spanInfo.PixelStride)];
|
||||
r -= color.R;
|
||||
g -= color.G;
|
||||
b -= color.B;
|
||||
hits--;
|
||||
}
|
||||
|
||||
var rightSide = x + halfRange;
|
||||
if (rightSide < spanInfo.Right)
|
||||
{
|
||||
ref Bgr32 color = ref rgb24[rightSide + (y * spanInfo.PixelStride)];
|
||||
r += color.R;
|
||||
g += color.G;
|
||||
b += color.B;
|
||||
hits++;
|
||||
}
|
||||
|
||||
ref Bgr32 average = ref averages[(x % range)];
|
||||
average.R = (byte)(r / hits);
|
||||
average.G = (byte)(g / hits);
|
||||
average.B = (byte)(b / hits);
|
||||
|
||||
if (leftSide >= spanInfo.Left)
|
||||
{
|
||||
// Now we can write the value from the calculated avarages
|
||||
var readLocation = (leftSide % range);
|
||||
|
||||
rgb24[leftSide + (y * spanInfo.PixelStride)] = averages[readLocation];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BoxBlurVertical is a private helper method for the BoxBlur
|
||||
/// </summary>
|
||||
/// <param name="spanInfo"></param>
|
||||
/// <param name="range">Range must be odd!</param>
|
||||
private static void BoxBlurVerticalSpan(SpanInfo spanInfo, int range)
|
||||
{
|
||||
var halfRange = range / 2;
|
||||
Parallel.For(spanInfo.Left, spanInfo.Right, x =>
|
||||
{
|
||||
unsafe {
|
||||
var rgb24 = new Span<Bgr32>((byte*)spanInfo.Pointer, spanInfo.BitmapSize);
|
||||
Span<Bgr32> averages = stackalloc Bgr32[range];
|
||||
var hits = 0;
|
||||
var r = 0;
|
||||
var g = 0;
|
||||
var b = 0;
|
||||
for (var y = spanInfo.Top; y < spanInfo.Top + halfRange; y++)
|
||||
{
|
||||
ref Bgr32 color = ref rgb24[(y * spanInfo.PixelStride) + x];
|
||||
r += color.R;
|
||||
g += color.G;
|
||||
b += color.B;
|
||||
hits++;
|
||||
}
|
||||
for (var y = spanInfo.Top; y < spanInfo.Bottom; y++)
|
||||
{
|
||||
var topSide = y - halfRange - 1;
|
||||
if (topSide >= spanInfo.Top)
|
||||
{
|
||||
// Get value at the top side of range
|
||||
ref Bgr32 color = ref rgb24[x + (topSide * spanInfo.PixelStride)];
|
||||
r -= color.R;
|
||||
g -= color.G;
|
||||
b -= color.B;
|
||||
hits--;
|
||||
}
|
||||
|
||||
var bottomSide = y + halfRange;
|
||||
if (bottomSide < spanInfo.Bottom)
|
||||
{
|
||||
ref Bgr32 color = ref rgb24[x + (bottomSide * spanInfo.PixelStride)];
|
||||
r += color.R;
|
||||
g += color.G;
|
||||
b += color.B;
|
||||
hits++;
|
||||
}
|
||||
|
||||
ref Bgr32 average = ref averages[y % range];
|
||||
average.R = (byte)(r / hits);
|
||||
average.G = (byte)(g / hits);
|
||||
average.B = (byte)(b / hits);
|
||||
|
||||
if (topSide >= spanInfo.Top)
|
||||
{
|
||||
// Write the value from the calculated avarages
|
||||
var readLocation = (topSide % range);
|
||||
|
||||
rgb24[x + (topSide * spanInfo.PixelStride)] = averages[readLocation];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BoxBlurHorizontal is a private helper method for the BoxBlur, only for IFastBitmaps with alpha channel
|
||||
/// </summary>
|
||||
/// <param name="spanInfo"></param>
|
||||
/// <param name="range">Range must be odd!</param>
|
||||
private static void BoxBlurHorizontalSpanAlpha(SpanInfo spanInfo, int range)
|
||||
{
|
||||
var halfRange = range / 2;
|
||||
|
||||
Parallel.For(spanInfo.Top, spanInfo.Bottom, y =>
|
||||
{
|
||||
unsafe {
|
||||
var argb32 = new Span<Bgra32>((byte*)spanInfo.Pointer, spanInfo.BitmapSize);
|
||||
Span<Bgra32> averages = stackalloc Bgra32[range];
|
||||
var a = 0;
|
||||
var r = 0;
|
||||
var g = 0;
|
||||
var b = 0;
|
||||
var hits = halfRange;
|
||||
var lineOffset = y * spanInfo.PixelStride;
|
||||
for (var x = spanInfo.Left; x < spanInfo.Left + halfRange; x++)
|
||||
{
|
||||
ref Bgra32 color = ref argb32[x + lineOffset];
|
||||
a += color.A;
|
||||
r += color.R;
|
||||
g += color.G;
|
||||
b += color.B;
|
||||
}
|
||||
for (var x = spanInfo.Left; x < spanInfo.Right; x++)
|
||||
{
|
||||
var leftSide = x - halfRange - 1;
|
||||
if (leftSide >= spanInfo.Left)
|
||||
{
|
||||
// Get value at the left side of range
|
||||
ref Bgra32 color = ref argb32[leftSide + lineOffset];
|
||||
a -= color.A;
|
||||
r -= color.R;
|
||||
g -= color.G;
|
||||
b -= color.B;
|
||||
hits--;
|
||||
}
|
||||
|
||||
var rightSide = x + halfRange;
|
||||
if (rightSide < spanInfo.Right)
|
||||
{
|
||||
ref Bgra32 color = ref argb32[rightSide + lineOffset];
|
||||
a += color.A;
|
||||
r += color.R;
|
||||
g += color.G;
|
||||
b += color.B;
|
||||
hits++;
|
||||
}
|
||||
|
||||
ref Bgra32 average = ref averages[x % range];
|
||||
average.A = (byte)(a / hits);
|
||||
average.R = (byte)(r / hits);
|
||||
average.G = (byte)(g / hits);
|
||||
average.B = (byte)(b / hits);
|
||||
|
||||
if (leftSide >= spanInfo.Left)
|
||||
{
|
||||
// Now we can write the value from the calculated avarages
|
||||
var readLocation = (leftSide % range);
|
||||
|
||||
argb32[leftSide + lineOffset] = averages[readLocation];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BoxBlurVertical is a private helper method for the BoxBlur
|
||||
/// </summary>
|
||||
/// <param name="spanInfo"></param>
|
||||
/// <param name="range">Range must be odd!</param>
|
||||
private static void BoxBlurVerticalSpanAlpha(SpanInfo spanInfo, int range)
|
||||
{
|
||||
var halfRange = range / 2;
|
||||
Parallel.For(spanInfo.Left, spanInfo.Right, x =>
|
||||
{
|
||||
Span<Bgra32> argb32;
|
||||
unsafe { argb32 = new Span<Bgra32>((byte*)spanInfo.Pointer, spanInfo.BitmapSize); }
|
||||
unsafe
|
||||
{
|
||||
Span<Bgra32> averages = stackalloc Bgra32[range];
|
||||
var hits = 0;
|
||||
var a = 0;
|
||||
var r = 0;
|
||||
var g = 0;
|
||||
var b = 0;
|
||||
for (var y = spanInfo.Top; y < spanInfo.Top + halfRange; y++)
|
||||
{
|
||||
ref Bgra32 color = ref argb32[x + (y * spanInfo.PixelStride)];
|
||||
a += color.A;
|
||||
r += color.R;
|
||||
g += color.G;
|
||||
b += color.B;
|
||||
hits++;
|
||||
}
|
||||
for (var y = spanInfo.Top; y < spanInfo.Bottom; y++)
|
||||
{
|
||||
var topSide = y - halfRange - 1;
|
||||
if (topSide >= spanInfo.Top)
|
||||
{
|
||||
// Get value at the top side of range
|
||||
ref Bgra32 color = ref argb32[x + (topSide * spanInfo.PixelStride)];
|
||||
a -= color.A;
|
||||
r -= color.R;
|
||||
g -= color.G;
|
||||
b -= color.B;
|
||||
hits--;
|
||||
}
|
||||
|
||||
var bottomSide = y + halfRange;
|
||||
if (bottomSide < spanInfo.Bottom)
|
||||
{
|
||||
ref Bgra32 color = ref argb32[x + (bottomSide * spanInfo.PixelStride)];
|
||||
a += color.A;
|
||||
r += color.R;
|
||||
g += color.G;
|
||||
b += color.B;
|
||||
hits++;
|
||||
}
|
||||
|
||||
ref Bgra32 average = ref averages[(y % range)];
|
||||
average.A = (byte)(a / hits);
|
||||
average.R = (byte)(r / hits);
|
||||
average.G = (byte)(g / hits);
|
||||
average.B = (byte)(b / hits);
|
||||
|
||||
if (topSide >= spanInfo.Top)
|
||||
{
|
||||
// Write the value from the calculated avarages
|
||||
var readLocation = (topSide % range);
|
||||
|
||||
argb32[x + (topSide * spanInfo.PixelStride)] = averages[readLocation];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net472;netcoreapp3.0</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net472' ">
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Runtime.Caching" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Windows" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Interfaces\IGreenshotContract.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Buffers">
|
||||
<Version>4.5.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Memory">
|
||||
<Version>4.5.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Numerics.Vectors">
|
||||
<Version>4.5.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
|
||||
<Version>4.5.2</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Greenshot.Gfx\Greenshot.Gfx.csproj">
|
||||
<Project>{f041c685-eb96-4ed1-9ace-0f5bd836610f}</Project>
|
||||
<Name>Greenshot.Gfx</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,48 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Greenshot.Gfx.Experimental.Structs
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class SpanInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Pointer to the memory
|
||||
/// </summary>
|
||||
public IntPtr Pointer;
|
||||
/// <summary>
|
||||
/// How many bytes are on a single line
|
||||
/// </summary>
|
||||
public int PixelStride;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Height;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Width;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Left;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Right;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Top;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Bottom;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int BitmapSize;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
|
||||
</startup>
|
||||
</configuration>
|
|
@ -23,10 +23,9 @@
|
|||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Greenshot.Gfx.Experimental.Structs;
|
||||
using Greenshot.Gfx.Structs;
|
||||
|
||||
|
||||
namespace Greenshot.Gfx.Experimental
|
||||
namespace Greenshot.Gfx
|
||||
{
|
||||
/// <summary>
|
||||
/// Code to apply a box blur
|
|
@ -33,7 +33,7 @@
|
|||
</PackageReference>
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0006" />
|
||||
<PackageReference Include="Svg">
|
||||
<Version>2.4.1</Version>
|
||||
<Version>2.4.2</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -64,13 +64,16 @@ namespace Greenshot.Gfx
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void AddBytes(byte one, byte two, byte three, byte four)
|
||||
{
|
||||
var k = (uint)(one | two << 8 | three << 16 | four << 24);
|
||||
k *= C1;
|
||||
k = RotateLeft(k, R1);
|
||||
k *= C2;
|
||||
_hash ^= k;
|
||||
_hash = RotateLeft(_hash, R2);
|
||||
_hash = _hash * M + N;
|
||||
unchecked
|
||||
{
|
||||
var k = (uint)(one | two << 8 | three << 16 | four << 24);
|
||||
k *= C1;
|
||||
k = RotateLeft(k, R1);
|
||||
k *= C2;
|
||||
_hash ^= k;
|
||||
_hash = RotateLeft(_hash, R2);
|
||||
_hash = _hash * M + N;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -81,11 +84,14 @@ namespace Greenshot.Gfx
|
|||
/// <param name="three">third byte</param>
|
||||
public void AddTrailingBytes(byte one, byte two = 0, byte three = 0)
|
||||
{
|
||||
var k = (uint)(one | two << 8 | three << 16);
|
||||
k *= C1;
|
||||
k = RotateLeft(k, R1);
|
||||
k *= C2;
|
||||
_hash ^= k;
|
||||
unchecked
|
||||
{
|
||||
var k = (uint) (one | two << 8 | three << 16);
|
||||
k *= C1;
|
||||
k = RotateLeft(k, R1);
|
||||
k *= C2;
|
||||
_hash ^= k;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -127,11 +133,14 @@ namespace Greenshot.Gfx
|
|||
get
|
||||
{
|
||||
var hash = _hash ^ _length;
|
||||
hash ^= hash >> 16;
|
||||
hash *= 0x85ebca6b;
|
||||
hash ^= hash >> 13;
|
||||
hash *= 0xc2b2ae35;
|
||||
hash ^= hash >> 16;
|
||||
unchecked
|
||||
{
|
||||
hash ^= hash >> 16;
|
||||
hash *= 0x85ebca6b;
|
||||
hash ^= hash >> 13;
|
||||
hash *= 0xc2b2ae35;
|
||||
hash ^= hash >> 16;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Greenshot.Gfx.Experimental
|
||||
namespace Greenshot.Gfx
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the ScaleX code for the UnmanagedBitmap
|
|
@ -24,7 +24,7 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Greenshot.Gfx.Experimental
|
||||
namespace Greenshot.Gfx
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the ScaleX code for the UnmanagedBitmap
|
|
@ -1,8 +1,11 @@
|
|||
namespace Greenshot.Gfx.Experimental.Structs
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Greenshot.Gfx.Structs
|
||||
{
|
||||
/// <summary>
|
||||
/// A struct with the BGR values for a 24bit pixel
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Bgr24
|
||||
{
|
||||
/// <summary>
|
|
@ -22,12 +22,14 @@
|
|||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Greenshot.Gfx.Experimental.Structs
|
||||
namespace Greenshot.Gfx.Structs
|
||||
{
|
||||
/// <summary>
|
||||
/// A struct with the BGR values for a 32bit pixel
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Bgr32 : IEquatable<Bgr32>
|
||||
{
|
||||
/// <summary>
|
|
@ -22,12 +22,14 @@
|
|||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Greenshot.Gfx.Experimental.Structs
|
||||
namespace Greenshot.Gfx.Structs
|
||||
{
|
||||
/// <summary>
|
||||
/// A struct with the BGR values for a 32bit pixel
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Bgra32 : IEquatable<Bgra32>
|
||||
{
|
||||
/// <summary>
|
|
@ -26,9 +26,9 @@ using System.Drawing;
|
|||
using System.Drawing.Imaging;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Greenshot.Gfx.Experimental.Structs;
|
||||
using Greenshot.Gfx.Structs;
|
||||
|
||||
namespace Greenshot.Gfx.Experimental
|
||||
namespace Greenshot.Gfx
|
||||
{
|
||||
/// <summary>
|
||||
/// A bitmap wraper with memory from Marshal.AllocHGlobal
|
|
@ -2,9 +2,8 @@
|
|||
using System.Drawing.Imaging;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Greenshot.Gfx;
|
||||
using Greenshot.Gfx.Experimental;
|
||||
using Greenshot.Gfx.Experimental.Structs;
|
||||
using Greenshot.Gfx.Quantizer;
|
||||
using Greenshot.Gfx.Structs;
|
||||
using Greenshot.Tests.Implementation;
|
||||
|
||||
namespace Greenshot.PerformanceTests
|
||||
|
@ -75,20 +74,6 @@ namespace Greenshot.PerformanceTests
|
|||
}
|
||||
}
|
||||
|
||||
//[Benchmark]
|
||||
public void Blur_Span()
|
||||
{
|
||||
using (var bitmap = BitmapFactory.CreateEmpty(400, 400, PixelFormat.Format32bppRgb, Color.White))
|
||||
{
|
||||
using (var graphics = Graphics.FromImage(bitmap))
|
||||
using (var pen = new SolidBrush(Color.Blue))
|
||||
{
|
||||
graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340));
|
||||
}
|
||||
bitmap.ApplyBoxBlurSpan(10);
|
||||
}
|
||||
}
|
||||
|
||||
//[Benchmark]
|
||||
public void Blur_UnmanagedBitmap()
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Drawing.Imaging;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Greenshot.Gfx;
|
||||
using Greenshot.Gfx.Experimental;
|
||||
|
||||
namespace Greenshot.PerformanceTests
|
||||
{
|
||||
|
@ -28,22 +27,5 @@ namespace Greenshot.PerformanceTests
|
|||
bitmap.ApplyBoxBlur(10);
|
||||
}
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
[Arguments(PixelFormat.Format24bppRgb)]
|
||||
[Arguments(PixelFormat.Format32bppRgb)]
|
||||
[Arguments(PixelFormat.Format32bppArgb)]
|
||||
public void BlurSpan(PixelFormat pixelFormat)
|
||||
{
|
||||
using (var bitmap = BitmapFactory.CreateEmpty(400, 400, pixelFormat, Color.White))
|
||||
{
|
||||
using (var graphics = Graphics.FromImage(bitmap))
|
||||
using (var pen = new SolidBrush(Color.Blue))
|
||||
{
|
||||
graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340));
|
||||
}
|
||||
bitmap.ApplyBoxBlurSpan(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,14 @@
|
|||
<TargetFrameworks>net472;netcoreapp3.0</TargetFrameworks>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net472|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net472|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
|
||||
<PackageReference Include="System.Console" Version="4.3.1" />
|
||||
|
@ -50,13 +58,13 @@
|
|||
<ItemGroup>
|
||||
<ProjectReference Include="..\Greenshot.Addons\Greenshot.Addons.csproj" />
|
||||
<ProjectReference Include="..\Greenshot.Core\Greenshot.Core.csproj" />
|
||||
<ProjectReference Include="..\Greenshot.Gfx.Experimental\Greenshot.Gfx.Experimental.csproj" />
|
||||
<ProjectReference Include="..\Greenshot.Gfx\Greenshot.Gfx.csproj" />
|
||||
<ProjectReference Include="..\Greenshot.Tests\Greenshot.Tests.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.11.4" />
|
||||
<PackageReference Include="ClrHeapAllocationAnalyzer" Version="1.0.0.9" />
|
||||
<PackageReference Include="CommandLineParser" Version="2.4.3" />
|
||||
<PackageReference Include="JeremyAnsel.ColorQuant" Version="1.0.55" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
|
||||
|
|
|
@ -23,10 +23,8 @@
|
|||
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using Greenshot.Gfx;
|
||||
using Greenshot.Gfx.Experimental;
|
||||
using Greenshot.Gfx.Experimental.Structs;
|
||||
using Greenshot.Gfx.Structs;
|
||||
using Greenshot.Tests.Implementation;
|
||||
using Xunit;
|
||||
|
||||
|
@ -65,33 +63,6 @@ namespace Greenshot.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(PixelFormat.Format24bppRgb)]
|
||||
[InlineData(PixelFormat.Format32bppRgb)]
|
||||
[InlineData(PixelFormat.Format32bppArgb)]
|
||||
public void Test_Blur_Span(PixelFormat pixelFormat)
|
||||
{
|
||||
using (var bitmapNew = BitmapFactory.CreateEmpty(400, 400, pixelFormat, Color.White))
|
||||
using (var bitmapOld = BitmapFactory.CreateEmpty(400, 400, pixelFormat, Color.White))
|
||||
{
|
||||
using (var graphics = Graphics.FromImage(bitmapNew))
|
||||
using (var pen = new SolidBrush(Color.Blue))
|
||||
{
|
||||
graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340));
|
||||
bitmapNew.ApplyBoxBlurSpan(10);
|
||||
}
|
||||
using (var graphics = Graphics.FromImage(bitmapOld))
|
||||
using (var pen = new SolidBrush(Color.Blue))
|
||||
{
|
||||
graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340));
|
||||
bitmapOld.ApplyOldBoxBlur(10);
|
||||
}
|
||||
bitmapOld.Save(@"old.png", ImageFormat.Png);
|
||||
bitmapNew.Save(@"new.png", ImageFormat.Png);
|
||||
|
||||
Assert.True(bitmapOld.IsEqualTo(bitmapNew), "New blur doesn't compare to old.");
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Test_Blur_UnmanagedBitmap()
|
||||
|
@ -103,8 +74,7 @@ namespace Greenshot.Tests
|
|||
using (var pen = new SolidBrush(Color.Blue))
|
||||
{
|
||||
graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340));
|
||||
//bitmapOld.ApplyOldBoxBlur(10);
|
||||
bitmapOld.ApplyBoxBlurSpan(10);
|
||||
bitmapOld.ApplyOldBoxBlur(10);
|
||||
}
|
||||
bitmapOld.Save(@"old.png", ImageFormat.Png);
|
||||
|
||||
|
|
|
@ -23,10 +23,13 @@
|
|||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
using Dapplo.Windows.Desktop;
|
||||
using Dapplo.Windows.Icons;
|
||||
using Dapplo.Windows.User32.Structs;
|
||||
using Greenshot.Addons.Config.Impl;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Core;
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Greenshot.Tests
|
|||
[Fact]
|
||||
public void TestLanguageOption()
|
||||
{
|
||||
var arguments = new[] { "-language", "de-DE" };
|
||||
var arguments = new[] { "--language", "de-DE" };
|
||||
|
||||
CommandlineCaptureOptions captureOptions = null;
|
||||
CommandlineOptions commandlineOptions = null;
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Greenshot.Tests
|
|||
graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340));
|
||||
}
|
||||
bitmap1.Save("bitmap0.png", ImageFormat.Png);
|
||||
bitmap1.ApplyBoxBlur(20);
|
||||
bitmap1.ApplyBoxBlur(10);
|
||||
bitmap1.Save("bitmap1.png", ImageFormat.Png);
|
||||
|
||||
using (var graphics = Graphics.FromImage(bitmap2))
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
<PackageReference Include="Dapplo.CaliburnMicro.Translations" Version="1.2.21" />
|
||||
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Log.XUnit" Version="1.3.11" />
|
||||
<PackageReference Include="Dapplo.Windows" Version="0.8.17" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.6.3">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
@ -94,7 +95,6 @@
|
|||
<ItemGroup>
|
||||
<ProjectReference Include="..\Greenshot.Addons\Greenshot.Addons.csproj" />
|
||||
<ProjectReference Include="..\Greenshot.Core\Greenshot.Core.csproj" />
|
||||
<ProjectReference Include="..\Greenshot.Gfx.Experimental\Greenshot.Gfx.Experimental.csproj" />
|
||||
<ProjectReference Include="..\Greenshot.Gfx\Greenshot.Gfx.csproj" />
|
||||
<ProjectReference Include="..\Greenshot\Greenshot.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -26,8 +26,7 @@ using System.Drawing.Imaging;
|
|||
using Dapplo.Log;
|
||||
using Dapplo.Log.XUnit;
|
||||
using Greenshot.Gfx;
|
||||
using Greenshot.Gfx.Experimental;
|
||||
using Greenshot.Gfx.Experimental.Structs;
|
||||
using Greenshot.Gfx.Structs;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28407.52
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.421
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot", "Greenshot\Greenshot.csproj", "{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}"
|
||||
EndProject
|
||||
|
@ -41,8 +41,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot.Tests", "Greensho
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot.Addon.LegacyEditor", "Greenshot.Addon.LegacyEditor\Greenshot.Addon.LegacyEditor.csproj", "{9F89C5A0-EB75-4F01-97EB-FBC0725733F2}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot.Gfx.Experimental", "Greenshot.Gfx.Experimental\Greenshot.Gfx.Experimental.csproj", "{14894A45-AA2C-4BC3-85A3-E388D0BDC1CA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot.Addon.OneDrive", "Greenshot.Addon.OneDrive\Greenshot.Addon.OneDrive.csproj", "{B35272D3-4631-4FA5-9A3E-85D70ECA9A8D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot.Addon.Tfs", "Greenshot.Addon.Tfs\Greenshot.Addon.Tfs.csproj", "{8B3643A5-AFED-49FF-8D66-6348FB102EB2}"
|
||||
|
@ -213,14 +211,6 @@ Global
|
|||
{9F89C5A0-EB75-4F01-97EB-FBC0725733F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9F89C5A0-EB75-4F01-97EB-FBC0725733F2}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{9F89C5A0-EB75-4F01-97EB-FBC0725733F2}.Release|x86.Build.0 = Release|Any CPU
|
||||
{14894A45-AA2C-4BC3-85A3-E388D0BDC1CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{14894A45-AA2C-4BC3-85A3-E388D0BDC1CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{14894A45-AA2C-4BC3-85A3-E388D0BDC1CA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{14894A45-AA2C-4BC3-85A3-E388D0BDC1CA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{14894A45-AA2C-4BC3-85A3-E388D0BDC1CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{14894A45-AA2C-4BC3-85A3-E388D0BDC1CA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{14894A45-AA2C-4BC3-85A3-E388D0BDC1CA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{14894A45-AA2C-4BC3-85A3-E388D0BDC1CA}.Release|x86.Build.0 = Release|Any CPU
|
||||
{B35272D3-4631-4FA5-9A3E-85D70ECA9A8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B35272D3-4631-4FA5-9A3E-85D70ECA9A8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B35272D3-4631-4FA5-9A3E-85D70ECA9A8D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Greenshot.Components
|
|||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
private static readonly Regex VersionRegex = new Regex(@"^.*[^-]-(?<version>[0-9\.]+)\-(?<type>(release|beta|rc[0-9]+))\.exe.*", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Uri UpdateFeed = new Uri("http://getgreenshot.org/project-feed/");
|
||||
private static readonly Uri UpdateFeed = new Uri("https://getgreenshot.org/project-feed/");
|
||||
private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
private readonly ICoreConfiguration _coreConfiguration;
|
||||
|
@ -93,7 +93,10 @@ namespace Greenshot.Components
|
|||
_updateNotificationViewModelFactory = updateNotificationViewModelFactory;
|
||||
var version = FileVersionInfo.GetVersionInfo(GetType().Assembly.Location);
|
||||
LatestVersion = CurrentVersion = new Version(version.FileMajorPart, version.FileMinorPart, version.FileBuildPart);
|
||||
_coreConfiguration.LastSaveWithVersion = CurrentVersion.ToString();
|
||||
if (_coreConfiguration != null)
|
||||
{
|
||||
_coreConfiguration.LastSaveWithVersion = CurrentVersion.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -175,7 +178,11 @@ namespace Greenshot.Components
|
|||
{
|
||||
return;
|
||||
}
|
||||
_coreConfiguration.LastUpdateCheck = DateTime.Now;
|
||||
|
||||
if (_coreConfiguration != null)
|
||||
{
|
||||
_coreConfiguration.LastUpdateCheck = DateTime.Now;
|
||||
}
|
||||
|
||||
ProcessFeed(updateFeed);
|
||||
|
||||
|
@ -236,7 +243,8 @@ namespace Greenshot.Components
|
|||
{
|
||||
BetaVersion = version;
|
||||
}
|
||||
if ("rc".Equals(type, StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
if (type.StartsWith("rc", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
ReleaseCandidateVersion = version;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac.Extras.CommonServiceLocator" Version="5.0.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.19.0" />
|
||||
<PackageReference Include="AutoProperties.Fody" Version="1.20.0" />
|
||||
<PackageReference Include="CommandLineParser" Version="2.4.3" />
|
||||
<PackageReference Include="CommonServiceLocator" Version="2.0.4" />
|
||||
<PackageReference Include="Dapplo.CaliburnMicro.Dapp" Version="1.2.21" />
|
||||
|
@ -89,16 +89,16 @@
|
|||
<PackageReference Include="Dapplo.HttpExtensions.OAuth" Version="0.9.18" />
|
||||
<PackageReference Include="Dapplo.Log.LogFile" Version="1.3.11" />
|
||||
<PackageReference Include="Dapplo.Log.Loggers" Version="1.3.11" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Icons" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Multimedia" Version="0.8.9" />
|
||||
<PackageReference Include="Dapplo.Windows.Clipboard" Version="0.8.17" />
|
||||
<PackageReference Include="Dapplo.Windows.Icons" Version="0.8.17" />
|
||||
<PackageReference Include="Dapplo.Windows.Multimedia" Version="0.8.17" />
|
||||
<PackageReference Include="Fody" Version="4.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="gong-wpf-dragdrop" Version="2.0.0-alpha0106" />
|
||||
<PackageReference Include="MahApps.Metro.IconPacks" Version="3.0.0-alpha0103" />
|
||||
<PackageReference Include="Svg" Version="2.4.1" />
|
||||
<PackageReference Include="Svg" Version="2.4.2" />
|
||||
<PackageReference Include="System.Runtime" Version="4.3.1" />
|
||||
<PackageReference Include="System.Runtime.Extensions" Version="4.3.1" />
|
||||
</ItemGroup>
|
||||
|
@ -108,6 +108,5 @@
|
|||
<ProjectReference Include="..\Greenshot.Core\Greenshot.Core.csproj" />
|
||||
<ProjectReference Include="..\Greenshot.Gfx\Greenshot.Gfx.csproj" />
|
||||
<ProjectReference Include="..\Greenshot.Addons\Greenshot.Addons.csproj" />
|
||||
<ProjectReference Condition="$(OsProductName.Contains('Windows 10'))" Include="..\Greenshot.Addon.Win10\Greenshot.Addon.Win10.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue