Skip to content

Commit 44ef4fe

Browse files
vadd98swharden
andauthored
Replace System.Drawing.Common with SkiaSharp to improve cross platform support (#61)
* SkiaSharp implementation * Target NET 8 * Improved ImageMaker performances * Target NET 8 * Removed System.Drawing references * Fix spectrogram orientation * Fix Colormap * modernize tests * modernize demo * Spectrogram: resolve warnings * demo: resolve warnings * nuget: version 2.0.0-alpha * Colormap: replace with a single class that uses ScottPlot * CICS: build and test with .NET 8 --------- Co-authored-by: Scott W Harden <[email protected]>
1 parent 5aeee49 commit 44ef4fe

37 files changed

+600
-1843
lines changed

Diff for: .github/workflows/ci.yaml

+8-15
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,24 @@ jobs:
1717
runs-on: windows-latest
1818
steps:
1919
- name: 🛒 Checkout
20-
uses: actions/checkout@v2
21-
22-
- name: ✨ Setup .NET 6
23-
uses: actions/setup-dotnet@v1
20+
uses: actions/checkout@v4
21+
- name: ✨ Setup .NET 8
22+
uses: actions/setup-dotnet@v4
2423
with:
25-
dotnet-version: "6.0.x"
26-
24+
dotnet-version: "8.0.x"
2725
- name: 🚚 Restore
2826
run: dotnet restore src
29-
3027
- name: 🛠️ Build
31-
run: dotnet build src --configuration Release --no-restore
32-
28+
run: dotnet build src --configuration Release
3329
- name: 🧪 Test
34-
run: dotnet test src --configuration Release --no-build
35-
30+
run: dotnet test src --configuration Release
3631
- name: 📦 Pack
37-
run: dotnet pack src --configuration Release --no-build
38-
32+
run: dotnet pack src --configuration Release
3933
- name: 🔑 Configure Secrets
4034
if: github.event_name == 'release'
4135
uses: nuget/setup-nuget@v1
4236
with:
4337
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
44-
45-
- name: 🚀 Deploy Package
38+
- name: 🚀 Deploy NuGet Package
4639
if: github.event_name == 'release'
4740
run: nuget push "src\Spectrogram\bin\Release\*.nupkg" -SkipDuplicate -Source https://api.nuget.org/v3/index.json

Diff for: src/Spectrogram.MicrophoneDemo/App.config

-6
This file was deleted.

Diff for: src/Spectrogram.MicrophoneDemo/FormMicrophone.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Text;
1010
using System.Threading.Tasks;
1111
using System.Windows.Forms;
12+
using SkiaSharp.Views.Desktop;
1213

1314
namespace Spectrogram.MicrophoneDemo
1415
{
@@ -64,7 +65,7 @@ private void StartListening()
6465
pbSpectrogram.Height = spec.Height;
6566

6667
pbScaleVert.Image?.Dispose();
67-
pbScaleVert.Image = spec.GetVerticalScale(pbScaleVert.Width);
68+
pbScaleVert.Image = spec.GetVerticalScale(pbScaleVert.Width).ToBitmap();
6869
pbScaleVert.Height = spec.Height;
6970
}
7071

@@ -85,7 +86,7 @@ private void timer1_Tick(object sender, EventArgs e)
8586
using (var gfx = Graphics.FromImage(bmpSpec))
8687
using (var pen = new Pen(Color.White))
8788
{
88-
gfx.DrawImage(bmpSpecIndexed, 0, 0);
89+
gfx.DrawImage(bmpSpecIndexed.ToBitmap(), 0, 0);
8990
if (cbRoll.Checked)
9091
{
9192
gfx.DrawLine(pen, spec.NextColumnIndex, 0, spec.NextColumnIndex, pbSpectrogram.Height);

Diff for: src/Spectrogram.MicrophoneDemo/Program.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
2+
using System.Runtime.Versioning;
53
using System.Windows.Forms;
64

75
namespace Spectrogram.MicrophoneDemo
86
{
97
static class Program
108
{
11-
/// <summary>
12-
/// The main entry point for the application.
13-
/// </summary>
149
[STAThread]
1510
static void Main()
1611
{

Diff for: src/Spectrogram.MicrophoneDemo/Properties/AssemblyInfo.cs

-36
This file was deleted.

Diff for: src/Spectrogram.MicrophoneDemo/Properties/Resources.Designer.cs

-71
This file was deleted.

Diff for: src/Spectrogram.MicrophoneDemo/Properties/Resources.resx

-117
This file was deleted.

Diff for: src/Spectrogram.MicrophoneDemo/Properties/Settings.Designer.cs

-30
This file was deleted.

Diff for: src/Spectrogram.MicrophoneDemo/Properties/Settings.settings

-7
This file was deleted.
+5-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net6.0-windows</TargetFramework>
3+
<TargetFramework>net8.0-windows</TargetFramework>
44
<OutputType>WinExe</OutputType>
5-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
65
<UseWindowsForms>true</UseWindowsForms>
76
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
7+
<NoWarn>NU1701</NoWarn>
88
</PropertyGroup>
99
<ItemGroup>
1010
<ProjectReference Include="..\Spectrogram\Spectrogram.csproj" />
11-
</ItemGroup>
12-
<ItemGroup>
13-
<PackageReference Include="FftSharp" Version="2.0.0" />
14-
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
15-
<PackageReference Include="NAudio" Version="1.10.0" />
16-
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
17-
<PackageReference Include="System.Drawing.Common" Version="5.0.0" />
11+
<PackageReference Include="FftSharp" Version="2.1.0" />
12+
<PackageReference Include="NAudio" Version="2.2.1" />
13+
<PackageReference Include="SkiaSharp.Views" Version="2.88.8" />
1814
</ItemGroup>
1915
</Project>

Diff for: src/Spectrogram.MicrophoneDemo/packages.config

-6
This file was deleted.

0 commit comments

Comments
 (0)