Skip to content

Commit 08fa95a

Browse files
committed
Migration to .NET6
1 parent b6edf1b commit 08fa95a

30 files changed

+811
-950
lines changed

Cofoundry.Plugins.Imaging.SkiaSharp.Tests/Shared/TestImage.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

Cofoundry.Plugins.Imaging.SkiaSharp.Tests/Shared/TestImages.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

Cofoundry.Plugins.Imaging.SkiaSharp.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{8B60
99
EndProject
1010
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharpExample", "src\SkiaSharpExample\SkiaSharpExample.csproj", "{84AF2A45-AB3B-4AA0-91FF-F8C266E3F683}"
1111
EndProject
12-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cofoundry.Plugins.Imaging.SkiaSharp.Tests", "Cofoundry.Plugins.Imaging.SkiaSharp.Tests\Cofoundry.Plugins.Imaging.SkiaSharp.Tests.csproj", "{F8D237CF-5483-4DD8-9130-0B37DB4D5AC3}"
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cofoundry.Plugins.Imaging.SkiaSharp.Tests", "test\Cofoundry.Plugins.Imaging.SkiaSharp.Tests\Cofoundry.Plugins.Imaging.SkiaSharp.Tests.csproj", "{F8D237CF-5483-4DD8-9130-0B37DB4D5AC3}"
1313
EndProject
1414
Global
1515
GlobalSection(SolutionConfigurationPlatforms) = preSolution
File renamed without changes.

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version: '{build}'
2-
image: Visual Studio 2019
2+
image: Visual Studio 2022
33
environment:
44
NUGET_API_KEY:
55
secure: ZipOsavSURgYiPIWD01xFd9ug5f8/qaNNsHRwuPsqlSFrr6adAwd4yG4qgDQ6jOC
Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
using Cofoundry.Core.DependencyInjection;
22
using Cofoundry.Domain;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Text;
63

7-
namespace Cofoundry.Plugins.Imaging.SkiaSharp
4+
namespace Cofoundry.Plugins.Imaging.SkiaSharp;
5+
6+
public class SkiaResizerDependencyRegistration : IDependencyRegistration
87
{
9-
public class SkiaResizerDependencyRegistration : IDependencyRegistration
8+
public void Register(IContainerRegister container)
109
{
11-
public void Register(IContainerRegister container)
12-
{
13-
var overrideOptions = RegistrationOptions.Override();
10+
var overrideOptions = RegistrationOptions.Override();
1411

15-
container
16-
.Register<IImageAssetFileService, SkiaSharpImageAssetFileService>(overrideOptions)
17-
.Register<IResizedImageAssetFileService, SkiaSharpResizedImageAssetFileService>(overrideOptions)
18-
.Register<ISkiaSharpResizeSettingsValidator, SkiaSharpResizeSettingsValidator>()
19-
.Register<IResizeSpecificationFactory, ResizeSpecificationFactory>()
20-
.Register<ISkiaSharpImageResizer, SkiaSharpImageResizer>()
21-
;
22-
}
12+
container
13+
.Register<IImageAssetFileService, SkiaSharpImageAssetFileService>(overrideOptions)
14+
.Register<IResizedImageAssetFileService, SkiaSharpResizedImageAssetFileService>(overrideOptions)
15+
.Register<ISkiaSharpResizeSettingsValidator, SkiaSharpResizeSettingsValidator>()
16+
.Register<IResizeSpecificationFactory, ResizeSpecificationFactory>()
17+
.Register<ISkiaSharpImageResizer, SkiaSharpImageResizer>()
18+
;
2319
}
2420
}

src/Cofoundry.Plugins.Imaging.SkiaSharp/Cofoundry.Plugins.Imaging.SkiaSharp.csproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
56

67
<PackageId>Cofoundry.Plugins.Imaging.SkiaSharp</PackageId>
78
<Description>Handle image validation and resizing in Cofoundry using the SkiaSharp library.</Description>
@@ -15,13 +16,13 @@
1516
</PropertyGroup>
1617

1718
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
18-
<DocumentationFile>bin\Release\netcoreapp3.1\Cofoundry.Plugins.Imaging.SkiaSharp.xml</DocumentationFile>
19+
<DocumentationFile>bin\Release\net6.0\Cofoundry.Plugins.Imaging.SkiaSharp.xml</DocumentationFile>
1920
<NoWarn>1701;1702;1705;1591</NoWarn>
2021
</PropertyGroup>
2122

2223
<ItemGroup>
23-
<PackageReference Include="Cofoundry.Web" Version="0.10.0" />
24-
<PackageReference Include="SkiaSharp" Version="2.80.2" />
24+
<PackageReference Include="Cofoundry.Web" Version="0.10.4-ci0006" />
25+
<PackageReference Include="SkiaSharp" Version="2.80.0" />
2526
</ItemGroup>
2627

2728
</Project>
Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
1+
namespace Cofoundry.Plugins.Imaging.SkiaSharp;
42

5-
namespace Cofoundry.Plugins.Imaging.SkiaSharp
3+
/// <summary>
4+
/// Used to indicate the bahaviour that should be applied to gifs as
5+
/// they are unsupported by SkiaSharp
6+
/// </summary>
7+
public enum GifResizeBehaviour
68
{
79
/// <summary>
8-
/// Used to indicate the bahaviour that should be applied to gifs as
9-
/// they are unsupported by SkiaSharp
10+
/// Save single frame gifs as PNGs, but leave animated gifs untouched
11+
/// and do not resize them.
1012
/// </summary>
11-
public enum GifResizeBehaviour
12-
{
13-
/// <summary>
14-
/// Save single frame gifs as PNGs, but leave animated gifs untouched
15-
/// and do not resize them.
16-
/// </summary>
17-
Auto,
13+
Auto,
1814

19-
/// <summary>
20-
/// Dont resize, output the original image instead.
21-
/// </summary>
22-
NoResize,
15+
/// <summary>
16+
/// Dont resize, output the original image instead.
17+
/// </summary>
18+
NoResize,
2319

24-
/// <summary>
25-
/// Re-encoded all gifs to pngs when they are uploaded.
26-
/// </summary>
27-
ResizeAsAlternative
28-
}
20+
/// <summary>
21+
/// Re-encoded all gifs to pngs when they are uploaded.
22+
/// </summary>
23+
ResizeAsAlternative
2924
}
Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,34 @@
11
using Cofoundry.Core.Configuration;
2-
using System;
3-
using System.Collections.Generic;
42
using System.ComponentModel.DataAnnotations;
5-
using System.Text;
63

7-
namespace Cofoundry.Plugins.Imaging.SkiaSharp
4+
namespace Cofoundry.Plugins.Imaging.SkiaSharp;
5+
6+
/// <summary>
7+
/// Basic settings for image resizing behavior using SkiaSharp.
8+
/// </summary>
9+
public class SkiaSharpSettings : PluginConfigurationSettingsBase
810
{
9-
/// <summary>
10-
/// Basic settings for image resizing behavior using SkiaSharp.
11-
/// </summary>
12-
public class SkiaSharpSettings : PluginConfigurationSettingsBase
11+
public SkiaSharpSettings()
1312
{
14-
public SkiaSharpSettings()
15-
{
16-
JpegQuality = 85;
17-
}
13+
JpegQuality = 85;
14+
}
1815

19-
/// <summary>
20-
/// Jpeg quality setting out of 100. Defaults to 85.
21-
/// </summary>
22-
[Range(0, 100)]
23-
public int JpegQuality { get; set; }
16+
/// <summary>
17+
/// Jpeg quality setting out of 100. Defaults to 85.
18+
/// </summary>
19+
[Range(0, 100)]
20+
public int JpegQuality { get; set; }
2421

25-
/// <summary>
26-
/// Gifs can be saved but not resized. Use this to customize the
27-
/// fallback behaviour.
28-
/// </summary>
29-
public GifResizeBehaviour GifResizeBehaviour { get; set; }
22+
/// <summary>
23+
/// Gifs can be saved but not resized. Use this to customize the
24+
/// fallback behaviour.
25+
/// </summary>
26+
public GifResizeBehaviour GifResizeBehaviour { get; set; }
3027

31-
/// <summary>
32-
/// Disables reading and writing of caching of resized image files.
33-
/// Useful for debugging, but note that cache headers are still set and
34-
/// files may be cached upstream.
35-
/// </summary>
36-
public bool DisableFileCache { get; set; }
37-
}
28+
/// <summary>
29+
/// Disables reading and writing of caching of resized image files.
30+
/// Useful for debugging, but note that cache headers are still set and
31+
/// files may be cached upstream.
32+
/// </summary>
33+
public bool DisableFileCache { get; set; }
3834
}
Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
11
using Cofoundry.Domain;
22
using SkiaSharp;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Text;
63

7-
namespace Cofoundry.Plugins.Imaging.SkiaSharp
4+
namespace Cofoundry.Plugins.Imaging.SkiaSharp;
5+
6+
/// <summary>
7+
/// Factory to produce a specification detailing the target dimensions and
8+
/// cropping required in a resize operation.
9+
/// </summary>
10+
public interface IResizeSpecificationFactory
811
{
912
/// <summary>
10-
/// Factory to produce a specification detailing the target dimensions and
13+
/// Produces a specification detailing the target dimensions and
1114
/// cropping required in a resize operation.
1215
/// </summary>
13-
public interface IResizeSpecificationFactory
14-
{
15-
/// <summary>
16-
/// Produces a specification detailing the target dimensions and
17-
/// cropping required in a resize operation.
18-
/// </summary>
19-
/// <param name="sourceCodec">
20-
/// The file header data from the source image file. This does not get disposed.
21-
/// </param>
22-
/// <param name="sourceImage">The source image pixel data. This does not get disposed.</param>
23-
/// <param name="resizeSettings">
24-
/// The resize settings that indicate the desired outcome and rules of the
25-
/// resize operation.
26-
/// </param>
27-
/// <returns></returns>
28-
ResizeSpecification Create(
29-
SKCodec sourceCodec,
30-
SKBitmap sourceImage,
31-
IImageResizeSettings resizeSettings
32-
);
33-
}
16+
/// <param name="sourceCodec">
17+
/// The file header data from the source image file. This does not get disposed.
18+
/// </param>
19+
/// <param name="sourceImage">The source image pixel data. This does not get disposed.</param>
20+
/// <param name="resizeSettings">
21+
/// The resize settings that indicate the desired outcome and rules of the
22+
/// resize operation.
23+
/// </param>
24+
/// <returns></returns>
25+
ResizeSpecification Create(
26+
SKCodec sourceCodec,
27+
SKBitmap sourceImage,
28+
IImageResizeSettings resizeSettings
29+
);
3430
}

0 commit comments

Comments
 (0)