Use the new GLControl packages for WinForms (#2989)

This commit is contained in:
Matthew Leibowitz 2024-09-19 02:04:14 +08:00 коммит произвёл GitHub
Родитель 9cbf9c80b7
Коммит 60b07b722e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
6 изменённых файлов: 32 добавлений и 14 удалений

Просмотреть файл

@ -11,11 +11,6 @@
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenTK" Version="3.1.0" NoWarn="NU1701" />
<PackageReference Include="OpenTK.GLControl" Version="3.1.0" NoWarn="NU1701" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\binding\SkiaSharp\SkiaSharp.csproj" />
<ProjectReference Include="..\..\..\..\source\SkiaSharp.Views\SkiaSharp.Views.Desktop.Common\SkiaSharp.Views.Desktop.Common.csproj" />

Просмотреть файл

@ -117,7 +117,8 @@
<!-- .NET Standard, .NET Framework and .NET -->
<PropertyGroup>
<BasicTargetFrameworksCurrent>netstandard2.0;netstandard2.1;net462;$(TFMCurrent)</BasicTargetFrameworksCurrent>
<FullFrameworkTargetFrameworks>net462</FullFrameworkTargetFrameworks>
<BasicTargetFrameworksCurrent>netstandard2.0;netstandard2.1;$(FullFrameworkTargetFrameworks);$(TFMCurrent)</BasicTargetFrameworksCurrent>
<PlatformTargetFrameworksCurrent Condition="!$(IsLinux)">$(TFMCurrent)-ios$(TPViOSCurrent);$(TFMCurrent)-maccatalyst$(TPVMacCatalystCurrent);$(TFMCurrent)-android$(TPVAndroidCurrent)</PlatformTargetFrameworksCurrent>
<PlatformTargetFrameworksCurrent Condition="!$(IsLinux) and $(IsNetTizenSupported)">$(PlatformTargetFrameworksCurrent);$(TFMCurrent)-tizen$(TPVTizenCurrent)</PlatformTargetFrameworksCurrent>
<PlatformTargetFrameworksCurrent Condition="!$(IsLinux) and $(IsNetTVOSSupported)">$(PlatformTargetFrameworksCurrent);$(TFMCurrent)-tvos$(TPVtvOSCurrent)</PlatformTargetFrameworksCurrent>
@ -151,7 +152,7 @@
<!-- Windows Desktop TFMs -->
<PropertyGroup>
<WindowsDesktopTargetFrameworks>net462</WindowsDesktopTargetFrameworks>
<WindowsDesktopTargetFrameworks></WindowsDesktopTargetFrameworks>
<WindowsDesktopTargetFrameworks Condition="$(IsWindows)">$(WindowsDesktopTargetFrameworks);$(WindowsTargetFrameworks)</WindowsDesktopTargetFrameworks>
</PropertyGroup>

Просмотреть файл

@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(WindowsDesktopTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(FullFrameworkTargetFrameworks);$(WindowsDesktopTargetFrameworks)</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>SkiaSharp.Views.WPF</RootNamespace>
<AssemblyName>SkiaSharp.Views.WPF</AssemblyName>
<PackagingGroup>SkiaSharp.Views.WPF</PackagingGroup>
<DefineConstants>$(DefineConstants);__DESKTOP__;__WPF__</DefineConstants>
<Title>SkiaSharp Views &amp; Layers for Windows Presentation Foundation (WPF)</Title>
<SignAssembly Condition="'$(TargetFramework)' != 'net462'">false</SignAssembly>
<SignAssembly Condition="!$(TargetFramework.StartsWith('net4'))">false</SignAssembly>
<PackageTags>wpf</PackageTags>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="OpenTK" Version="3.3.1" NoWarn="NU1701" />
<PackageReference Include="OpenTK.GLWpfControl" Version="3.3.0" NoWarn="NU1701" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="OpenTK" Version="4.3.0" NoWarn="NU1701" />
<PackageReference Include="OpenTK.GLWpfControl" Version="4.2.3" />
</ItemGroup>

Просмотреть файл

@ -2,6 +2,9 @@
using System.ComponentModel;
using System.Windows.Forms;
using OpenTK;
#if WINDOWS
using OpenTK.GLControl;
#endif
using OpenTK.Graphics;
using OpenTK.Graphics.ES20;
@ -24,6 +27,19 @@ namespace SkiaSharp.Views.Desktop
private SKSizeI lastSize;
#if WINDOWS
public SKGLControl()
: base(new GLControlSettings { AlphaBits = 8, RedBits = 8, GreenBits = 8, BlueBits = 8, DepthBits = 24, StencilBits = 8 })
{
Initialize();
}
public SKGLControl(GLControlSettings settings)
: base(settings)
{
Initialize();
}
#else
public SKGLControl()
: base(new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24, 8))
{
@ -41,6 +57,7 @@ namespace SkiaSharp.Views.Desktop
{
Initialize();
}
#endif
private void Initialize()
{

Просмотреть файл

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(WindowsDesktopTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(FullFrameworkTargetFrameworks);$(WindowsDesktopTargetFrameworks)</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>SkiaSharp.Views.Desktop</RootNamespace>
<AssemblyName>SkiaSharp.Views.WindowsForms</AssemblyName>
@ -8,11 +8,16 @@
<DefineConstants>$(DefineConstants);__DESKTOP__;__WINFORMS__</DefineConstants>
<Title>SkiaSharp Views &amp; Layers for Windows.Forms</Title>
<PackageTags>windows.forms;winforms</PackageTags>
<SignAssembly Condition="!$(TargetFramework.StartsWith('net4'))">false</SignAssembly>
</PropertyGroup>
<ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="OpenTK" Version="3.1.0" NoWarn="NU1701" />
<PackageReference Include="OpenTK.GLControl" Version="3.1.0" NoWarn="NU1701" />
</ItemGroup>
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="OpenTK" Version="4.8.2" />
<PackageReference Include="OpenTK.GLControl" Version="4.0.1" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<Reference Include="System.Windows.Forms" />
</ItemGroup>

Просмотреть файл

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(PlatformTargetFrameworks);$(WindowsDesktopTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(PlatformTargetFrameworks);$(FullFrameworkTargetFrameworks);$(WindowsDesktopTargetFrameworks)</TargetFrameworks>
<PackagingGroup>SkiaSharp.Views</PackagingGroup>
<PackageId>SkiaSharp.Views</PackageId>
<Title>SkiaSharp Views &amp; Layers for Android, iOS, Mac Catalyst, macOS, and tvOS</Title>